Documentation
¶
Index ¶
- type APIKey
- type APIKeyKey
- type APIKeySpec
- type Organization
- type OrganizationUser
- type S
- func (s *S) AutoMigrate() error
- func (s *S) CreateAPIKey(spec APIKeySpec) (*APIKey, error)
- func (s *S) CreateOrganization(tenantID, orgID, title, ns string) (*Organization, error)
- func (s *S) CreateOrganizationUser(orgID, userID, role string) (*OrganizationUser, error)
- func (s *S) DeleteAPIKey(k APIKeyKey) error
- func (s *S) DeleteOrganization(tenantID, orgID string) error
- func (s *S) DeleteOrganizationUser(orgID, userID string) error
- func (s *S) GetAPIKeyByNameAndTenantID(name, tenantID string) (*APIKey, error)
- func (s *S) GetOrganizationByTenantIDAndOrgID(tenantID, orgID string) (*Organization, error)
- func (s *S) GetOrganizationByTenantIDAndTitle(tenantID, title string) (*Organization, error)
- func (s *S) ListAPIKeysByTenantID(tenantID string) ([]*APIKey, error)
- func (s *S) ListAllAPIKeys() ([]*APIKey, error)
- func (s *S) ListAllOrganizationUsers() ([]OrganizationUser, error)
- func (s *S) ListAllOrganizations() ([]*Organization, error)
- func (s *S) ListOrganizationUsersByOrganizationID(orgID string) ([]OrganizationUser, error)
- func (s *S) ListOrganizations(tenantID string) ([]*Organization, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIKey ¶
type APIKey struct {
gorm.Model
APIKeyID string `gorm:"uniqueIndex:idx_api_key_api_key_id_tenant_id"`
Name string `gorm:"uniqueIndex:idx_api_key_name_tenant_id"`
TenantID string `gorm:"uniqueIndex:idx_api_key_api_key_id_tenant_id;uniqueIndex:idx_api_key_name_tenant_id"`
OrganizationID string
UserID string
Secret string
}
APIKey represents an API key.
type APIKeySpec ¶
APIKeySpec is a spec of the API key.
type Organization ¶ added in v0.8.0
type Organization struct {
gorm.Model
TenantID string `gorm:"index;uniqueIndex:idx_orgs_tenant_id_title"`
OrganizationID string `gorm:"uniqueIndex"`
Title string `gorm:"uniqueIndex:idx_orgs_tenant_id_title"`
// KubernetesNamespace is the namespace where the fine-tuning jobs for the organization run.
// TODO(kenji): Currently we don't set the unique constraint so that multiple orgs can use the same namespace,
// but revisit the design.
KubernetesNamespace string
}
Organization is a model for organization
func (*Organization) ToProto ¶ added in v0.10.0
func (o *Organization) ToProto() *v1.Organization
ToProto converts the organization to proto.
type OrganizationUser ¶ added in v0.13.0
type OrganizationUser struct {
gorm.Model
OrganizationID string `gorm:"uniqueIndex:user_id_org_id"`
UserID string `gorm:"uniqueIndex:user_id_org_id"`
Role string
}
OrganizationUser is a model for user_organization.
func (*OrganizationUser) ToProto ¶ added in v0.13.0
func (o *OrganizationUser) ToProto() *v1.OrganizationUser
ToProto converts the model to Porto.
type S ¶
type S struct {
// contains filtered or unexported fields
}
S represents the data store.
func (*S) AutoMigrate ¶
AutoMigrate sets up the auto-migration task of the database.
func (*S) CreateAPIKey ¶
func (s *S) CreateAPIKey(spec APIKeySpec) (*APIKey, error)
CreateAPIKey creates a new API key.
func (*S) CreateOrganization ¶ added in v0.10.0
func (s *S) CreateOrganization(tenantID, orgID, title, ns string) (*Organization, error)
CreateOrganization creates a new organization.
func (*S) CreateOrganizationUser ¶ added in v0.13.0
func (s *S) CreateOrganizationUser(orgID, userID, role string) (*OrganizationUser, error)
CreateOrganizationUser creates a organization user.
func (*S) DeleteAPIKey ¶
DeleteAPIKey deletes an APIKey by APIKey ID and tenant ID.
func (*S) DeleteOrganization ¶ added in v0.10.0
DeleteOrganization deletes an organization.
func (*S) DeleteOrganizationUser ¶ added in v0.22.0
DeleteOrganizationUser deletes a organization user.
func (*S) GetAPIKeyByNameAndTenantID ¶ added in v0.7.0
GetAPIKeyByNameAndTenantID gets an API key by its name and tenant ID.
func (*S) GetOrganizationByTenantIDAndOrgID ¶ added in v0.21.0
func (s *S) GetOrganizationByTenantIDAndOrgID(tenantID, orgID string) (*Organization, error)
GetOrganizationByTenantIDAndOrgID gets an organization.
func (*S) GetOrganizationByTenantIDAndTitle ¶ added in v0.16.0
func (s *S) GetOrganizationByTenantIDAndTitle(tenantID, title string) (*Organization, error)
GetOrganizationByTenantIDAndTitle gets an organization ID and a title.
func (*S) ListAPIKeysByTenantID ¶
ListAPIKeysByTenantID lists API keys by a tenant ID.
func (*S) ListAllAPIKeys ¶
ListAllAPIKeys lists all API keys.
func (*S) ListAllOrganizationUsers ¶ added in v0.13.0
func (s *S) ListAllOrganizationUsers() ([]OrganizationUser, error)
ListAllOrganizationUsers lists all organization users.
func (*S) ListAllOrganizations ¶ added in v0.25.0
func (s *S) ListAllOrganizations() ([]*Organization, error)
ListAllOrganizations lists all organizations.
func (*S) ListOrganizationUsersByOrganizationID ¶ added in v0.21.0
func (s *S) ListOrganizationUsersByOrganizationID(orgID string) ([]OrganizationUser, error)
ListOrganizationUsersByOrganizationID lists organization users in the specified organization.
func (*S) ListOrganizations ¶ added in v0.10.0
func (s *S) ListOrganizations(tenantID string) ([]*Organization, error)
ListOrganizations lists all organizations in the tenant.