Documentation ¶
Index ¶
- Variables
- func FormatPage(db *gorm.DB, page *Page) *gorm.DB
- func GenRoleID() (string, error)
- func GenUserID() (string, error)
- type Page
- type Role
- func (dao *Role) BeforeCreate(_ *gorm.DB) error
- func (dao *Role) Create(db *gorm.DB) error
- func (dao *Role) Delete(db *gorm.DB, where map[string]any) (affected int64, err error)
- func (dao *Role) IsExisted(db *gorm.DB, where map[string]any) (bool, error)
- func (dao *Role) List(db *gorm.DB, where map[string]any, page *Page, keywords string) (total int64, roles []*Role, err error)
- func (Role) TableName() string
- func (dao *Role) Update(db *gorm.DB, where map[string]any, updates map[string]any) (affected int64, err error)
- type Tenant
- func (o *Tenant) Create(db *gorm.DB) (err error)
- func (o *Tenant) Delete(db *gorm.DB) error
- func (o *Tenant) Existed(db *gorm.DB) (existed bool)
- func (o *Tenant) List(db *gorm.DB, where map[string]any, page *Page, keywords string) (total int64, tenants []*Tenant, err error)
- func (Tenant) TableName() string
- func (o *Tenant) Update(db *gorm.DB, where map[string]any, updates map[string]any) (affected int64, err error)
- type User
- func (u *User) BeforeCreate(_ *gorm.DB) error
- func (u *User) CountInTenant(db *gorm.DB, tenantID string) (int64, error)
- func (u *User) Create(db *gorm.DB) error
- func (u *User) Delete(db *gorm.DB) error
- func (u *User) DeleteAllInTenant(db *gorm.DB, tenantID string) error
- func (u *User) Encrypt() (err error)
- func (u *User) Existed(db *gorm.DB) (existed bool, err error)
- func (u *User) FirstOrAssignCreate(db *gorm.DB, where User, assign User) error
- func (u *User) QueryByCondition(db *gorm.DB, condition map[string]any, page *Page, keyWords string) (total int64, users []*User, err error)
- func (User) TableName() string
- func (u *User) Update(db *gorm.DB, tenantID, userID string, updates map[string]any) error
Constants ¶
This section is empty.
Variables ¶
View Source
var (
// DefaultPageNum default page num.
DefaultPageNum = 15
)
Functions ¶
Types ¶
type Role ¶
type Role struct { ID string `json:"id" gorm:"primaryKey"` Name string `json:"name" gorm:"type:varchar(128);not null;uniqueIndex:role_tenant"` TenantID string `json:"tenant_id" gorm:"type:varchar(32);default:'';uniqueIndex:role_tenant"` Description string `json:"description" gorm:"type:varchar(256);default:''"` CreatedAt time.Time UpdatedAt time.Time }
type Tenant ¶
type Tenant struct { ID string `json:"id" gorm:"primaryKey;type:varchar(32);comment:租户ID"` Title string `json:"title" gorm:"type:varchar(128);comment:租户标题; not null;index"` Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"` CreatedAt time.Time UpdatedAt time.Time }
type User ¶
type User struct { ID string `json:"id" gorm:"primaryKey"` ExternalID string `json:"external_id" gorm:"type:varchar(128);default:'';uniqueIndex:user_tenant"` TenantID string `json:"tenant_id" gorm:"type:varchar(32);column:tenant_id;not null;uniqueIndex:user_tenant"` UserName string `json:"username" gorm:"type:varchar(64);column:username;not null;uniqueIndex:user_tenant"` // nolint Password string `json:"-" gorm:"type:varchar(128);column:password;not null"` NickName string `json:"nick_name" gorm:"type:varchar(128);comment:昵称"` Avatar string `json:"avatar" gorm:"type:varchar(255);comment:头像"` Email string `json:"email" gorm:"type:varchar(128);column:email;comment:邮箱"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
func AuthenticateUser ¶
func MappingFromExternal ¶
func (*User) CountInTenant ¶
func (*User) DeleteAllInTenant ¶
func (*User) FirstOrAssignCreate ¶
Click to show internal directories.
Click to hide internal directories.