Documentation
¶
Index ¶
- Variables
- func AutoMigrate(db *gorm.DB) error
- func CombineQueryParts(queryParts []string) string
- func GetProjectQuery(filter *entity.ProjectFilter) (string, []interface{})
- func NewBlogRepository(db *gorm.DB) repository.BlogRepository
- func NewOrganizationRepository(db *gorm.DB) repository.OrganizationRepository
- func NewProjectRepository(db *gorm.DB) repository.ProjectRepository
- func NewUserRepository(db *gorm.DB) repository.UserRepository
- type BaseModel
- type BlogModel
- type MultiString
- type OrganizationModel
- type OrganizationRole
- type ProjectModel
- type ResourceModel
- type UserModel
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrUserModelNil = errors.New("user model is nil") ErrOrganizationModelNil = errors.New("organization model is nil") ErrProjectModelNil = errors.New("project model is nil") ErrFailedToConvertOrgToEntity = errors.New("failed to convert organization to entity") ErrFailedToConvertUserToEntity = errors.New("failed to convert user to entity") ErrBlogModelNil = errors.New("blog model is nil") )
View Source
var LoadModels = []interface{}{ &UserModel{}, &OrganizationModel{}, &ProjectModel{}, &BlogModel{}, }
Functions ¶
func AutoMigrate ¶
func CombineQueryParts ¶
func GetProjectQuery ¶
func GetProjectQuery(filter *entity.ProjectFilter) (string, []interface{})
func NewBlogRepository ¶
func NewBlogRepository(db *gorm.DB) repository.BlogRepository
NewBlogRepository creates a new blog repository.
func NewOrganizationRepository ¶
func NewOrganizationRepository(db *gorm.DB) repository.OrganizationRepository
NewOrganizationRepository creates a new organization repository.
func NewProjectRepository ¶
func NewProjectRepository(db *gorm.DB) repository.ProjectRepository
NewProjectRepository creates a new project repository.
func NewUserRepository ¶
func NewUserRepository(db *gorm.DB) repository.UserRepository
Types ¶
type BlogModel ¶
type BlogModel struct { ResourceModel Path string `gorm:"index:unique_blog,unique"` RawData []byte `gorm:"type:bytea"` }
func (*BlogModel) FromEntity ¶
FromEntity converts an entity to a DO.
type MultiString ¶
type MultiString []string
func (MultiString) GormDBDataType ¶
GormDBDataType gorm db data type
func (MultiString) GormDataType ¶
func (s MultiString) GormDataType() string
GormDataType gorm common data type
func (*MultiString) Scan ¶
func (s *MultiString) Scan(src any) error
Scan implements the Scanner interface for the MultiString type.
type OrganizationModel ¶
type OrganizationModel struct { BaseModel Name string `gorm:"index:unique_organization,unique"` Labels MultiString `gorm:"type:text[]"` }
func (*OrganizationModel) FromEntity ¶
func (o *OrganizationModel) FromEntity(entity *entity.Organization) error
func (*OrganizationModel) TableName ¶
func (o *OrganizationModel) TableName() string
func (*OrganizationModel) ToEntity ¶
func (o *OrganizationModel) ToEntity() (*entity.Organization, error)
type OrganizationRole ¶
type OrganizationRole string
const ( OrganizationRoleOwner OrganizationRole = "owner" OrganizationRoleAdmin OrganizationRole = "admin" OrganizationRoleUser OrganizationRole = "user" )
type ProjectModel ¶
type ProjectModel struct { ResourceModel Name string `gorm:"index:unique_project,unique"` OrganizationID uuid.UUID Organization *OrganizationModel `gorm:"foreignKey:OrganizationID;references:ID"` Path string `gorm:"index:unique_project,unique"` Labels MultiString }
func (*ProjectModel) FromEntity ¶
func (m *ProjectModel) FromEntity(e *entity.Project) error
FromEntity converts an entity to a DO.
func (*ProjectModel) TableName ¶
func (m *ProjectModel) TableName() string
The TableName method returns the name of the database table that the struct is mapped to.
type ResourceModel ¶
type ResourceModel struct { BaseModel CreatedByID uuid.UUID CreatedBy *UserModel `gorm:"foreignKey:CreatedByID;references:ID"` }
func (*ResourceModel) BeforeCreate ¶
func (r *ResourceModel) BeforeCreate(tx *gorm.DB) error
Click to show internal directories.
Click to hide internal directories.