Documentation
¶
Index ¶
- func GetDataPermissionDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- func GetEndpointDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- func GetModelAliasDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- func GetModelCatalogDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- func GetModelCatalogI18nDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- func GetModelDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- func GetModelPriceVersionDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- func GetProviderDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- type DataPermission
- func (a *DataPermission) Create(ctx context.Context, item *schema.DataPermission) error
- func (a *DataPermission) Delete(ctx context.Context, id string) error
- func (a *DataPermission) DeleteByTypeAndDataId(ctx context.Context, dataType, dataId string) error
- func (a *DataPermission) Exists(ctx context.Context, id string) (bool, error)
- func (a *DataPermission) Get(ctx context.Context, id string, opts ...schema.DataPermissionQueryOptions) (*schema.DataPermission, error)
- func (a *DataPermission) HasReadPermission(ctx context.Context, dataType, dataId, user, tenant string) (bool, error)
- func (a *DataPermission) Query(ctx context.Context, params schema.DataPermissionQueryParam, ...) (*schema.DataPermissionQueryResult, error)
- func (a *DataPermission) Update(ctx context.Context, item *schema.DataPermission) error
- type Endpoint
- func (e *Endpoint) Create(ctx context.Context, item *schema.Endpoint) error
- func (e *Endpoint) Delete(ctx context.Context, id string) error
- func (e *Endpoint) Exists(ctx context.Context, id string) (bool, error)
- func (e *Endpoint) ExistsByCode(ctx context.Context, code string, excludeID string) (bool, error)
- func (e *Endpoint) ExistsDuplicate(ctx context.Context, ...) (bool, error)
- func (e *Endpoint) Get(ctx context.Context, id string, opts ...schema.EndpointQueryOptions) (*schema.Endpoint, error)
- func (e *Endpoint) Query(ctx context.Context, params schema.EndpointQueryParam, ...) (*schema.EndpointQueryResult, error)
- func (e *Endpoint) QueryEndpointsByModelCode(ctx context.Context, modelCode string) (schema.Endpoints, error)
- func (e *Endpoint) QueryEndpointsByModelID(ctx context.Context, modelID string) (schema.Endpoints, error)
- func (e *Endpoint) QueryEndpointsByProviderID(ctx context.Context, providerID string) (schema.Endpoints, error)
- func (e *Endpoint) Update(ctx context.Context, item *schema.Endpoint) error
- func (e *Endpoint) UpdateApiKeyByProviderAndOldKey(ctx context.Context, providerID, oldKey, newKey string) error
- func (e *Endpoint) UpdateEnabled(ctx context.Context, id string, enabled int, modifier string) error
- type Model
- func (m *Model) Create(ctx context.Context, item *schema.Model) error
- func (m *Model) Delete(ctx context.Context, id string) error
- func (m *Model) Exists(ctx context.Context, id string) (bool, error)
- func (m *Model) ExistsByModelCode(ctx context.Context, modelCode string) (bool, error)
- func (m *Model) ExistsByModelName(ctx context.Context, modelName string) (bool, error)
- func (m *Model) Get(ctx context.Context, id string, opts ...schema.ModelQueryOptions) (*schema.Model, error)
- func (m *Model) GetIDByModelCode(ctx context.Context, modelCode string) (string, error)
- func (m *Model) GetModelCodeByID(ctx context.Context, id string) (string, error)
- func (m *Model) Query(ctx context.Context, params schema.ModelQueryParam, ...) (*schema.ModelQueryResult, error)
- func (m *Model) Update(ctx context.Context, item *schema.Model) error
- func (m *Model) UpdateEnabled(ctx context.Context, id string, enabled int, modifier string) error
- type ModelAlias
- func (m *ModelAlias) CountByModelId(ctx context.Context, modelId string) (int64, error)
- func (m *ModelAlias) Create(ctx context.Context, item *schema.ModelAlias) error
- func (m *ModelAlias) Delete(ctx context.Context, id string) error
- func (m *ModelAlias) Exists(ctx context.Context, id string) (bool, error)
- func (m *ModelAlias) ExistsByAlias(ctx context.Context, alias string) (bool, error)
- func (m *ModelAlias) ExistsByUniqueKey(ctx context.Context, spaceCode, alias string) (bool, error)
- func (m *ModelAlias) Get(ctx context.Context, id string, opts ...schema.ModelAliasQueryOptions) (*schema.ModelAlias, error)
- func (m *ModelAlias) ListByModelId(ctx context.Context, modelId string) (schema.ModelAliases, error)
- func (m *ModelAlias) Query(ctx context.Context, params schema.ModelAliasQueryParam, ...) (*schema.ModelAliasQueryResult, error)
- func (m *ModelAlias) Update(ctx context.Context, item *schema.ModelAlias) error
- type ModelCatalog
- func (m *ModelCatalog) Create(ctx context.Context, item *schema.ModelCatalog) error
- func (m *ModelCatalog) Delete(ctx context.Context, modelID string) error
- func (m *ModelCatalog) Exists(ctx context.Context, modelID string) (bool, error)
- func (m *ModelCatalog) ExistsBySlug(ctx context.Context, slug string, excludeModelID string) (bool, error)
- func (m *ModelCatalog) Get(ctx context.Context, modelID string, opts ...schema.ModelCatalogQueryOptions) (*schema.ModelCatalog, error)
- func (m *ModelCatalog) GetBySlug(ctx context.Context, slug string) (*schema.ModelCatalog, error)
- func (m *ModelCatalog) Query(ctx context.Context, params schema.ModelCatalogQueryParam, ...) (*schema.ModelCatalogQueryResult, error)
- func (m *ModelCatalog) QueryPublic(ctx context.Context, limit int) (schema.ModelCatalogs, error)
- func (m *ModelCatalog) Update(ctx context.Context, item *schema.ModelCatalog) error
- type ModelCatalogI18n
- func (m *ModelCatalogI18n) Create(ctx context.Context, item *schema.ModelCatalogI18n) error
- func (m *ModelCatalogI18n) Delete(ctx context.Context, modelID, locale string) error
- func (m *ModelCatalogI18n) DeleteByModelID(ctx context.Context, modelID string) error
- func (m *ModelCatalogI18n) Get(ctx context.Context, modelID, locale string) (*schema.ModelCatalogI18n, error)
- func (m *ModelCatalogI18n) Query(ctx context.Context, params schema.ModelCatalogI18nQueryParam, ...) (*schema.ModelCatalogI18nQueryResult, error)
- func (m *ModelCatalogI18n) QueryByModelID(ctx context.Context, modelID string) (schema.ModelCatalogI18ns, error)
- func (m *ModelCatalogI18n) Update(ctx context.Context, item *schema.ModelCatalogI18n) error
- func (m *ModelCatalogI18n) Upsert(ctx context.Context, item *schema.ModelCatalogI18n) error
- type ModelPriceVersion
- func (m *ModelPriceVersion) Create(ctx context.Context, item *schema.ModelPriceVersion) error
- func (m *ModelPriceVersion) Delete(ctx context.Context, id string) error
- func (m *ModelPriceVersion) Get(ctx context.Context, id string, opts ...schema.ModelPriceVersionQueryOptions) (*schema.ModelPriceVersion, error)
- func (m *ModelPriceVersion) GetCurrentPrice(ctx context.Context, modelID, currency string) (*schema.ModelPriceVersion, error)
- func (m *ModelPriceVersion) Query(ctx context.Context, params schema.ModelPriceVersionQueryParam, ...) (*schema.ModelPriceVersionQueryResult, error)
- func (m *ModelPriceVersion) QueryByModelID(ctx context.Context, modelID string) (schema.ModelPriceVersions, error)
- func (m *ModelPriceVersion) Update(ctx context.Context, item *schema.ModelPriceVersion) error
- type Provider
- func (p *Provider) Create(ctx context.Context, item *schema.Provider) error
- func (p *Provider) Delete(ctx context.Context, id string) error
- func (p *Provider) Exists(ctx context.Context, id string) (bool, error)
- func (p *Provider) ExistsCode(ctx context.Context, code string) (bool, error)
- func (p *Provider) ExistsName(ctx context.Context, name string) (bool, error)
- func (p *Provider) Get(ctx context.Context, id string, opts ...schema.ProviderQueryOptions) (*schema.Provider, error)
- func (p *Provider) Query(ctx context.Context, params schema.ProviderQueryParam, ...) (*schema.ProviderQueryResult, error)
- func (p *Provider) Update(ctx context.Context, item *schema.Provider) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDataPermissionDB ¶
Get data permission storage instance
func GetEndpointDB ¶
GetEndpointDB returns the database instance for Endpoint (only active records).
func GetModelAliasDB ¶
GetModelAliasDB returns the database instance for ModelAlias (only active records).
func GetModelCatalogDB ¶
GetModelCatalogDB returns the database instance for ModelCatalog.
func GetModelCatalogI18nDB ¶
GetModelCatalogI18nDB returns the database instance for ModelCatalogI18n.
func GetModelDB ¶
GetModelDB returns the database instance for Model (only active records).
func GetModelPriceVersionDB ¶
GetModelPriceVersionDB returns the database instance for ModelPriceVersion (only active records).
Types ¶
type DataPermission ¶
Data permission management
func (*DataPermission) Create ¶
func (a *DataPermission) Create(ctx context.Context, item *schema.DataPermission) error
Create a new data permission.
func (*DataPermission) Delete ¶
func (a *DataPermission) Delete(ctx context.Context, id string) error
Delete the specified data permission from the database.
func (*DataPermission) DeleteByTypeAndDataId ¶
func (a *DataPermission) DeleteByTypeAndDataId(ctx context.Context, dataType, dataId string) error
DeleteByTypeAndDataId deletes data permissions by type and data ID.
func (*DataPermission) Exists ¶
Exists checks if the specified data permission exists in the database.
func (*DataPermission) Get ¶
func (a *DataPermission) Get(ctx context.Context, id string, opts ...schema.DataPermissionQueryOptions) (*schema.DataPermission, error)
Get the specified data permission from the database.
func (*DataPermission) HasReadPermission ¶
func (a *DataPermission) HasReadPermission(ctx context.Context, dataType, dataId, user, tenant string) (bool, error)
HasReadPermission checks if a user has read permission for a specific data item.
func (*DataPermission) Query ¶
func (a *DataPermission) Query(ctx context.Context, params schema.DataPermissionQueryParam, opts ...schema.DataPermissionQueryOptions) (*schema.DataPermissionQueryResult, error)
Query data permissions from the database based on the provided parameters and options.
func (*DataPermission) Update ¶
func (a *DataPermission) Update(ctx context.Context, item *schema.DataPermission) error
Update the specified data permission in the database.
type Endpoint ¶
Endpoint data access layer
func (*Endpoint) ExistsByCode ¶
ExistsByCode checks if an endpoint with the given code exists.
func (*Endpoint) ExistsDuplicate ¶
func (e *Endpoint) ExistsDuplicate(ctx context.Context, modelID, providerID, url, apiKey, protocol, realModel string, excludeID string) (bool, error)
ExistsDuplicate checks if an active endpoint with the same route identity already exists.
func (*Endpoint) Get ¶
func (e *Endpoint) Get(ctx context.Context, id string, opts ...schema.EndpointQueryOptions) (*schema.Endpoint, error)
Get the specified endpoint from the database.
func (*Endpoint) Query ¶
func (e *Endpoint) Query(ctx context.Context, params schema.EndpointQueryParam, opts ...schema.EndpointQueryOptions) (*schema.EndpointQueryResult, error)
Query endpoints from the database.
func (*Endpoint) QueryEndpointsByModelCode ¶
func (e *Endpoint) QueryEndpointsByModelCode(ctx context.Context, modelCode string) (schema.Endpoints, error)
QueryEndpointsByModelCode queries enabled endpoints by model_code (for routing). Joins endpoint → model → provider and filters all three to enabled + not deleted.
func (*Endpoint) QueryEndpointsByModelID ¶
func (e *Endpoint) QueryEndpointsByModelID(ctx context.Context, modelID string) (schema.Endpoints, error)
QueryEndpointsByModelID queries endpoints by Model ID (only enabled endpoints).
func (*Endpoint) QueryEndpointsByProviderID ¶
func (e *Endpoint) QueryEndpointsByProviderID(ctx context.Context, providerID string) (schema.Endpoints, error)
QueryEndpointsByProviderID queries active endpoints by Provider ID.
func (*Endpoint) UpdateApiKeyByProviderAndOldKey ¶ added in v0.3.0
func (e *Endpoint) UpdateApiKeyByProviderAndOldKey(ctx context.Context, providerID, oldKey, newKey string) error
UpdateApiKeyByProviderAndOldKey updates the api_key of non-deleted endpoints associated with a provider if their api_key matches oldKey.
type Model ¶
Model data access layer
func (*Model) ExistsByModelCode ¶
ExistsByModelCode checks if a model with the given model_code exists.
func (*Model) ExistsByModelName ¶
ExistsByModelName checks if a model with the given model_name exists.
func (*Model) Get ¶
func (m *Model) Get(ctx context.Context, id string, opts ...schema.ModelQueryOptions) (*schema.Model, error)
Get the specified model from the database.
func (*Model) GetIDByModelCode ¶
GetIDByModelCode returns model id for the specified model_code.
func (*Model) GetModelCodeByID ¶
GetModelCodeByID returns model_code for the specified model id.
func (*Model) Query ¶
func (m *Model) Query(ctx context.Context, params schema.ModelQueryParam, opts ...schema.ModelQueryOptions) (*schema.ModelQueryResult, error)
Query models from the database.
type ModelAlias ¶
ModelAlias data access layer
func (*ModelAlias) CountByModelId ¶
CountByModelId counts active aliases for a given model ID.
func (*ModelAlias) Create ¶
func (m *ModelAlias) Create(ctx context.Context, item *schema.ModelAlias) error
Create a new model alias.
func (*ModelAlias) Delete ¶
func (m *ModelAlias) Delete(ctx context.Context, id string) error
Delete the specified model alias logically.
func (*ModelAlias) ExistsByAlias ¶
ExistsByAlias checks if a model alias with the given alias name exists (global scope).
func (*ModelAlias) ExistsByUniqueKey ¶
ExistsByUniqueKey checks if a model alias with the given space_code and alias exists.
func (*ModelAlias) Get ¶
func (m *ModelAlias) Get(ctx context.Context, id string, opts ...schema.ModelAliasQueryOptions) (*schema.ModelAlias, error)
Get the specified model alias from the database.
func (*ModelAlias) ListByModelId ¶
func (m *ModelAlias) ListByModelId(ctx context.Context, modelId string) (schema.ModelAliases, error)
ListByModelId returns all active aliases for a given model ID.
func (*ModelAlias) Query ¶
func (m *ModelAlias) Query(ctx context.Context, params schema.ModelAliasQueryParam, opts ...schema.ModelAliasQueryOptions) (*schema.ModelAliasQueryResult, error)
Query model aliases from the database.
func (*ModelAlias) Update ¶
func (m *ModelAlias) Update(ctx context.Context, item *schema.ModelAlias) error
Update the specified model alias.
type ModelCatalog ¶
ModelCatalog data access layer
func (*ModelCatalog) Create ¶
func (m *ModelCatalog) Create(ctx context.Context, item *schema.ModelCatalog) error
Create a new model catalog.
func (*ModelCatalog) Delete ¶
func (m *ModelCatalog) Delete(ctx context.Context, modelID string) error
Delete the specified model catalog.
func (*ModelCatalog) ExistsBySlug ¶
func (m *ModelCatalog) ExistsBySlug(ctx context.Context, slug string, excludeModelID string) (bool, error)
ExistsBySlug checks if a model catalog with the given slug exists.
func (*ModelCatalog) Get ¶
func (m *ModelCatalog) Get(ctx context.Context, modelID string, opts ...schema.ModelCatalogQueryOptions) (*schema.ModelCatalog, error)
Get the specified model catalog from the database.
func (*ModelCatalog) GetBySlug ¶
func (m *ModelCatalog) GetBySlug(ctx context.Context, slug string) (*schema.ModelCatalog, error)
GetBySlug gets a model catalog by slug.
func (*ModelCatalog) Query ¶
func (m *ModelCatalog) Query(ctx context.Context, params schema.ModelCatalogQueryParam, opts ...schema.ModelCatalogQueryOptions) (*schema.ModelCatalogQueryResult, error)
Query model catalogs from the database.
func (*ModelCatalog) QueryPublic ¶
func (m *ModelCatalog) QueryPublic(ctx context.Context, limit int) (schema.ModelCatalogs, error)
QueryPublic queries public available model catalogs for portal display.
func (*ModelCatalog) Update ¶
func (m *ModelCatalog) Update(ctx context.Context, item *schema.ModelCatalog) error
Update the specified model catalog.
type ModelCatalogI18n ¶
ModelCatalogI18n data access layer
func (*ModelCatalogI18n) Create ¶
func (m *ModelCatalogI18n) Create(ctx context.Context, item *schema.ModelCatalogI18n) error
Create a new i18n entry.
func (*ModelCatalogI18n) Delete ¶
func (m *ModelCatalogI18n) Delete(ctx context.Context, modelID, locale string) error
Delete deletes a specific i18n entry.
func (*ModelCatalogI18n) DeleteByModelID ¶
func (m *ModelCatalogI18n) DeleteByModelID(ctx context.Context, modelID string) error
DeleteByModelID deletes all i18n entries for a model.
func (*ModelCatalogI18n) Get ¶
func (m *ModelCatalogI18n) Get(ctx context.Context, modelID, locale string) (*schema.ModelCatalogI18n, error)
Get gets a specific i18n entry by model_id and locale.
func (*ModelCatalogI18n) Query ¶
func (m *ModelCatalogI18n) Query(ctx context.Context, params schema.ModelCatalogI18nQueryParam, opts ...schema.ModelCatalogI18nQueryOptions) (*schema.ModelCatalogI18nQueryResult, error)
Query model catalog i18n entries from the database.
func (*ModelCatalogI18n) QueryByModelID ¶
func (m *ModelCatalogI18n) QueryByModelID(ctx context.Context, modelID string) (schema.ModelCatalogI18ns, error)
QueryByModelID gets all i18n entries for a model.
func (*ModelCatalogI18n) Update ¶
func (m *ModelCatalogI18n) Update(ctx context.Context, item *schema.ModelCatalogI18n) error
Update the specified i18n entry.
func (*ModelCatalogI18n) Upsert ¶
func (m *ModelCatalogI18n) Upsert(ctx context.Context, item *schema.ModelCatalogI18n) error
Upsert creates or updates an i18n entry.
type ModelPriceVersion ¶
ModelPriceVersion data access layer
func (*ModelPriceVersion) Create ¶
func (m *ModelPriceVersion) Create(ctx context.Context, item *schema.ModelPriceVersion) error
Create a new model price version.
func (*ModelPriceVersion) Delete ¶
func (m *ModelPriceVersion) Delete(ctx context.Context, id string) error
Delete the specified model price version.
func (*ModelPriceVersion) Get ¶
func (m *ModelPriceVersion) Get(ctx context.Context, id string, opts ...schema.ModelPriceVersionQueryOptions) (*schema.ModelPriceVersion, error)
Get the specified model price version from the database.
func (*ModelPriceVersion) GetCurrentPrice ¶
func (m *ModelPriceVersion) GetCurrentPrice(ctx context.Context, modelID, currency string) (*schema.ModelPriceVersion, error)
GetCurrentPrice gets the currently effective price version for a model.
func (*ModelPriceVersion) Query ¶
func (m *ModelPriceVersion) Query(ctx context.Context, params schema.ModelPriceVersionQueryParam, opts ...schema.ModelPriceVersionQueryOptions) (*schema.ModelPriceVersionQueryResult, error)
Query model price versions from the database.
func (*ModelPriceVersion) QueryByModelID ¶
func (m *ModelPriceVersion) QueryByModelID(ctx context.Context, modelID string) (schema.ModelPriceVersions, error)
QueryByModelID queries all price versions for a model.
func (*ModelPriceVersion) Update ¶
func (m *ModelPriceVersion) Update(ctx context.Context, item *schema.ModelPriceVersion) error
Update the specified model price version.
type Provider ¶
Provider data access layer
func (*Provider) ExistsCode ¶
ExistsCode checks if a provider with the given code exists.
func (*Provider) ExistsName ¶
ExistsName checks if a provider with the given name exists.
func (*Provider) Get ¶
func (p *Provider) Get(ctx context.Context, id string, opts ...schema.ProviderQueryOptions) (*schema.Provider, error)
Get the specified provider from the database.
func (*Provider) Query ¶
func (p *Provider) Query(ctx context.Context, params schema.ProviderQueryParam, opts ...schema.ProviderQueryOptions) (*schema.ProviderQueryResult, error)
Query providers from the database.