Documentation ¶
Index ¶
- func New(ctx context.Context, dialect string, dsn string, config *gorm.Config) (db *gorm.DB, err error)
- func NewLogger(level string) *dlogger
- func NewMySQL(dsn string, config *gorm.Config) (*gorm.DB, error)
- func NewSQLite(file string, config *gorm.Config) (*gorm.DB, error)
- type Group
- type PKI
- type Permission
- type PermissionAction
- type PermissionType
- type Token
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(ctx context.Context, dialect string, dsn string, config *gorm.Config) (db *gorm.DB, err error)
New creates a new database connection
Types ¶
type Group ¶
type Group struct { ID int64 `gorm:"primaryKey;autoIncrement:false" json:"id"` Name string `json:"name"` Active bool `json:"active"` CreatedAt *time.Time `json:"created_at"` UpdatedAt *time.Time `json:"updated_at"` Users []*User `gorm:"many2many:user_groups" json:"users,omitempty"` Permissions []*Permission `gorm:"foreignKey:EntityID" json:"permissions,omitempty"` }
Group --
type PKI ¶
type Permission ¶
type Permission struct { ID int64 `gorm:"primaryKey;autoIncrement:false" json:"id"` Type PermissionType `gorm:"index:idx_permissions_unique,unique" json:"type"` Class string `gorm:"index:idx_permissions_unique,unique" json:"class,omitempty"` Name string `gorm:"index:idx_permissions_unique,unique" json:"name"` Action PermissionAction `json:"action"` EntityID int64 `json:"-"` User *User `gorm:"foreignKey:EntityID" json:"user,omitempty"` Group *Group `gorm:"foreignKey:EntityID" json:"group,omitempty"` CreatedAt *time.Time `json:"created_at"` UpdatedAt *time.Time `json:"updated_at"` }
func (*Permission) BeforeCreate ¶
func (p *Permission) BeforeCreate(tx *gorm.DB) error
type PermissionAction ¶
type PermissionAction string
const ( Pull PermissionAction = "pull" Push PermissionAction = "push" Admin PermissionAction = "admin" )
type PermissionType ¶
type PermissionType string
const ( Registry PermissionType = "registry" Catalog PermissionType = "catalog" Namespace PermissionType = "namespace" Repository PermissionType = "repository" )
type User ¶
type User struct { ID int64 `gorm:"primaryKey;autoIncrement:false" json:"id"` Name string `json:"name"` Username string `gorm:"uniqueIndex,size:255"` Password string `json:"-"` Admin bool `json:"admin"` Active bool `json:"active"` CreatedAt *time.Time `json:"created_at"` UpdatedAt *time.Time `json:"updated_at"` Groups []*Group `gorm:"many2many:user_groups" json:"groups,omitempty"` Permissions []*Permission `gorm:"foreignKey:EntityID" json:"permissions,omitempty"` Tokens []*Token `gorm:"foreignKey:UserID" json:"users,omitempty"` }
User --
Click to show internal directories.
Click to hide internal directories.