feat: complete remaining Go backend modules

This commit is contained in:
zn-admin committed 2026-08-14 00:02:43 +08:00
1 parent cea2751dc5
commit aef5a97165
145 files changed
+18376 -199

No files matched your search

+7
View File
@@ -31,6 +31,10 @@ const GetOwnerAssetSQL = `SELECT ` + assetFields + `
FROM public.assets AS a
WHERE a.owner_id = $1::text AND a.id = $2::text
LIMIT 1`
const GetOwnerAssetByStoragePathSQL = `SELECT ` + assetFields + `
FROM public.assets AS a
WHERE a.owner_id = $1::text AND a.storage_path = $2::text
LIMIT 1`
const listPublicAccessibleAssetIDs = `SELECT unnest(j.input_asset_ids || j.output_asset_ids) AS asset_id
FROM (
SELECT input_asset_ids, output_asset_ids
@@ -72,6 +76,9 @@ func (db *Database) ListOwner(ctx context.Context, owner string) ([]assets.Asset
func (db *Database) GetOwner(ctx context.Context, owner, id string) (assets.Asset, bool, error) {
return db.oneAsset(ctx, GetOwnerAssetSQL, owner, id)
}
func (db *Database) GetOwnerByStoragePath(ctx context.Context, owner, storagePath string) (assets.Asset, bool, error) {
return db.oneAsset(ctx, GetOwnerAssetByStoragePathSQL, owner, storagePath)
}
func (db *Database) ListPublic(ctx context.Context, owner, client string, limit int) ([]assets.Asset, error) {
return db.listAssets(ctx, ListPublicAssetsSQL, owner, assets.ClientTag(client), client, limit)
}