Documentation ¶
Index ¶
- Variables
- type App
- func (a *App) DeleteByIdForUID(tx *gorm.DB) error
- func (a *App) Exist(tx *gorm.DB) (bool, error)
- func (a *App) FirstAppCodeByID(tx *gorm.DB) error
- func (a *App) FirstAppKeyPairByAppCode(tx *gorm.DB) error
- func (a *App) FirstAppKeyPairByID(tx *gorm.DB) error
- func (a *App) FirstByAppCode(tx *gorm.DB) error
- func (a *App) FirstByID(tx *gorm.DB) error
- func (a *App) FirstCallbackByID(tx *gorm.DB) error
- func (a *App) FirstDetailedByIdAndUID(tx *gorm.DB) (*dto.AppShowDetail, error)
- func (a *App) GetAccessible(tx *gorm.DB) ([]dto.AppShowWithGroup, error)
- func (a *App) GetAllWithGroup(tx *gorm.DB) ([]dto.AppShowWithGroup, error)
- func (a *App) GetAppCode(tx *gorm.DB) ([]string, error)
- func (a *App) GetByUIDForAction(tx *gorm.DB) ([]App, error)
- func (a *App) GetByUIDForShow(tx *gorm.DB) ([]dto.AppShowOwner, error)
- func (a *App) GetByUIDForShowDetailed(tx *gorm.DB) ([]dto.AppShowDetail, error)
- func (a *App) GetForUpdateView(tx *gorm.DB) ([]App, error)
- func (a *App) GetPermitAll(tx *gorm.DB) ([]dto.AppShow, error)
- func (a *App) Insert(tx *gorm.DB) error
- func (a *App) UpdateLinkOff(tx *gorm.DB) error
- func (a *App) UpdateViewByID(tx *gorm.DB) error
- func (a *App) UpdatesByID(tx *gorm.DB) error
- func (a *App) UserAccessible(tx *gorm.DB) (bool, error)
- type AppGroup
- type BaseGroup
- func (a *BaseGroup) CreateGroups(tx *gorm.DB, groups []BaseGroup) error
- func (a *BaseGroup) GetAll(tx *gorm.DB) ([]BaseGroup, error)
- func (a *BaseGroup) GetAllForShow(tx *gorm.DB) ([]dto.Group, error)
- func (a *BaseGroup) GetByAppIdsRelatedForShow(tx *gorm.DB, apps ...uint) ([]dto.GroupRelateApp, error)
- func (a *BaseGroup) GetByIdsForShow(tx *gorm.DB, ids ...uint) ([]dto.Group, error)
- type FeishuGroups
- func (a *FeishuGroups) CreateAll(tx *gorm.DB, data []FeishuGroups) error
- func (a *FeishuGroups) DeleteByIDSlice(tx *gorm.DB, ids []uint) error
- func (a *FeishuGroups) GetAll(tx *gorm.DB) ([]FeishuGroups, error)
- func (a *FeishuGroups) GetByOpenIDSlice(tx *gorm.DB, openID []string) ([]FeishuGroups, error)
- func (a *FeishuGroups) GetGroupsByOpenIDSlice(tx *gorm.DB, openID []string) ([]BaseGroup, error)
- type LoginRecord
- func (a *LoginRecord) GetByUID(tx *gorm.DB, limit int) ([]dto.LoginRecord, error)
- func (a *LoginRecord) GetLastMonth(tx *gorm.DB) ([]LoginRecord, error)
- func (a *LoginRecord) GetMultipleViewsIds(tx *gorm.DB, apps []App) ([]dto.ViewID, error)
- func (a *LoginRecord) GetViewIds(tx *gorm.DB, startAt uint) ([]uint, error)
- func (a *LoginRecord) Insert(tx *gorm.DB) error
- type SiteWhiteList
- type User
- func (a *User) DelMfa(tx *gorm.DB) error
- func (a *User) FirstByID(tx *gorm.DB) error
- func (a *User) FirstByPhone(tx *gorm.DB) error
- func (a *User) FirstForPasskey(tx *gorm.DB) error
- func (a *User) FirstMfa(tx *gorm.DB) error
- func (a *User) FirstPhoneByID(tx *gorm.DB) error
- func (a *User) FirstProfileByID(tx *gorm.DB) (*dto.UserProfile, error)
- func (a *User) FrozeByIDSlice(tx *gorm.DB, ids []uint) error
- func (a *User) FrozeByPhone(tx *gorm.DB) *gorm.DB
- func (a *User) GetNoSshDevIds(tx *gorm.DB) ([]uint, error)
- func (a *User) GetNotInPhoneSlice(tx *gorm.DB, phone []string) ([]User, error)
- func (a *User) GetUnscopedByPhoneSlice(tx *gorm.DB, phone []string) ([]User, error)
- func (a *User) Insert(tx *gorm.DB) error
- func (a *User) InsertAll(tx *gorm.DB, users []User) error
- func (a *User) U2fStatus(tx *gorm.DB) (*dto.UserU2fStatus, error)
- func (a *User) UnfrozeByIDSlice(tx *gorm.DB, ids []uint) error
- func (a *User) UpdateAllInfoByID(tx *gorm.DB) *gorm.DB
- func (a *User) UpdateMfa(tx *gorm.DB) error
- func (a *User) UpdateU2fPreferByID(tx *gorm.DB) error
- type UserGroups
- func (a *UserGroups) DeleteByIDSlice(tx *gorm.DB, ids []uint) error
- func (a *UserGroups) DeleteNotInGidSliceByUID(tx *gorm.DB, ids []uint) *gorm.DB
- func (a *UserGroups) ExistByName(tx *gorm.DB, groupName string) (bool, error)
- func (a *UserGroups) GetAllNotFrozen(tx *gorm.DB) ([]UserGroups, error)
- func (a *UserGroups) GetGetUserGroupIdsByUID(tx *gorm.DB) ([]uint, error)
- func (a *UserGroups) GetUserGroupNamesByUID(tx *gorm.DB) ([]string, error)
- func (a *UserGroups) GetUserGroupsForAppCodeByUID(tx *gorm.DB, appCode string) *gorm.DB
- func (a *UserGroups) GetUserGroupsForShowByUID(tx *gorm.DB) ([]dto.Group, error)
- func (a *UserGroups) GetUserGroupsLimited(tx *gorm.DB, groups []string) ([]BaseGroup, error)
- func (a *UserGroups) InsertAll(tx *gorm.DB, data []UserGroups) error
- type UserSsh
- func (a *UserSsh) DeleteByIds(tx *gorm.DB, id ...uint) error
- func (a *UserSsh) Exist(tx *gorm.DB) (bool, error)
- func (a *UserSsh) FirstForUserShow(tx *gorm.DB) error
- func (a *UserSsh) GetAll(tx *gorm.DB) ([]dto.SshDeploy, error)
- func (a *UserSsh) GetInvalid(tx *gorm.DB) ([]UserSsh, error)
- func (a *UserSsh) Insert(tx *gorm.DB) error
- func (a *UserSsh) InsertAll(tx *gorm.DB, models []UserSsh) error
- func (a *UserSsh) UpdateByUid(tx *gorm.DB) error
- type UserWebauthn
- func (a *UserWebauthn) Delete(tx *gorm.DB) *gorm.DB
- func (a *UserWebauthn) Exist(tx *gorm.DB) (bool, error)
- func (a *UserWebauthn) GetByUID(tx *gorm.DB) ([]string, error)
- func (a *UserWebauthn) GetByUidForShow(tx *gorm.DB) ([]dto.UserCredential, error)
- func (a *UserWebauthn) Insert(tx *gorm.DB) error
- func (a *UserWebauthn) UpdateLastUsedAt(tx *gorm.DB) *gorm.DB
- func (a *UserWebauthn) UpdatesByID(tx *gorm.DB) error
Constants ¶
This section is empty.
Variables ¶
View Source
var DB *gorm.DB
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct { ID uint `gorm:"primarykey"` CreatedAt int64 // User.ID 拥有者 UID uint `gorm:"column:uid;index"` User *User `gorm:"foreignKey:UID;constraint:OnDelete:SET NULL"` Name string `gorm:"not null;uniqueIndex;type:varchar(20)"` AppCode string `gorm:"not null;uniqueIndex;type:varchar(36)"` AppSecret string `gorm:"not null"` Callback string `gorm:"not null"` PermitAllGroup bool // 以下仅用于导航标识 LinkOff bool `gorm:"index"` Views uint64 `gorm:"index"` // LoginRecord.ID 统计用,无需约束 ViewsID uint }
func (*App) FirstAppKeyPairByAppCode ¶ added in v1.17.2
func (*App) FirstDetailedByIdAndUID ¶
func (*App) GetAccessible ¶
func (*App) GetAllWithGroup ¶
func (*App) GetByUIDForShow ¶
func (*App) GetByUIDForShowDetailed ¶
type AppGroup ¶
type AppGroup struct { ID uint `gorm:"primarykey"` // App.ID AID uint `gorm:"column:aid;not null;index;index:app_group_idx,unique"` App *App `gorm:"foreignKey:AID;constraint:OnDelete:CASCADE"` // BaseGroup.ID GID uint `gorm:"column:gid;not null;index;index:app_group_idx,unique"` BaseGroup *BaseGroup `gorm:"foreignKey:GID;constraint:OnDelete:CASCADE"` }
type BaseGroup ¶
type BaseGroup struct { ID uint `gorm:"primarykey"` Name string `gorm:"not null;uniqueIndex;type:varchar(10)"` }
BaseGroup 该模型仅用于添加数据库约束,请勿用于创建含写入操作的 CRUD 接口
func (*BaseGroup) CreateGroups ¶
func (*BaseGroup) GetAllForShow ¶
func (*BaseGroup) GetByAppIdsRelatedForShow ¶
type FeishuGroups ¶
type FeishuGroups struct { ID uint `gorm:"primarykey"` Name string `gorm:"not null;unique"` OpenDepartmentId string `gorm:"not null;uniqueInde;type:varchar(255)"` // BaseGroup.ID GID uint `gorm:"uniqueIndex;not null;column:gid"` Group *BaseGroup `gorm:"foreignKey:GID;constraint:OnDelete:CASCADE"` }
func (*FeishuGroups) CreateAll ¶
func (a *FeishuGroups) CreateAll(tx *gorm.DB, data []FeishuGroups) error
func (*FeishuGroups) DeleteByIDSlice ¶
func (a *FeishuGroups) DeleteByIDSlice(tx *gorm.DB, ids []uint) error
func (*FeishuGroups) GetAll ¶
func (a *FeishuGroups) GetAll(tx *gorm.DB) ([]FeishuGroups, error)
func (*FeishuGroups) GetByOpenIDSlice ¶
func (a *FeishuGroups) GetByOpenIDSlice(tx *gorm.DB, openID []string) ([]FeishuGroups, error)
func (*FeishuGroups) GetGroupsByOpenIDSlice ¶
type LoginRecord ¶
type LoginRecord struct { ID uint `gorm:"primarykey"` CreatedAt int64 // User.ID UID uint `gorm:"not null;index;column:uid"` User *User `gorm:"foreignKey:UID;constraint:OnDelete:CASCADE"` IP string // App.ID 为 null 或 0 表示登录的是后台 AID *uint `gorm:"column:aid;index"` App *App `gorm:"foreignKey:AID;constraint:OnDelete:CASCADE"` }
func (*LoginRecord) GetByUID ¶
func (a *LoginRecord) GetByUID(tx *gorm.DB, limit int) ([]dto.LoginRecord, error)
func (*LoginRecord) GetLastMonth ¶
func (a *LoginRecord) GetLastMonth(tx *gorm.DB) ([]LoginRecord, error)
func (*LoginRecord) GetMultipleViewsIds ¶
func (*LoginRecord) GetViewIds ¶
type SiteWhiteList ¶
type User ¶
type User struct { ID uint `gorm:"primarykey"` DeletedAt gorm.DeletedAt `gorm:"index"` Name string `gorm:"not null"` Phone string `gorm:"not null;uniqueIndex;type:varchar(15)"` AvatarUrl string MFA string PreferU2F string `gorm:"column:prefer_u2f"` }
func (*User) FirstProfileByID ¶
func (*User) GetNoSshDevIds ¶
GetNoSshDevIds 获取没有分发 ssh 账号的研发部门用户
func (*User) GetNotInPhoneSlice ¶
func (*User) GetUnscopedByPhoneSlice ¶
type UserGroups ¶
type UserGroups struct { ID uint `gorm:"primarykey"` // User.ID UID uint `gorm:"index;index:user_group_idx,unique;not null;column:uid;"` User *User `gorm:"foreignKey:UID;constraint:OnDelete:CASCADE"` // BaseGroup.ID GID uint `gorm:"index;index:user_group_idx,unique;not null;column:gid"` BaseGroup *BaseGroup `gorm:"foreignKey:GID;constraint:OnDelete:CASCADE"` }
func (*UserGroups) DeleteByIDSlice ¶
func (a *UserGroups) DeleteByIDSlice(tx *gorm.DB, ids []uint) error
func (*UserGroups) DeleteNotInGidSliceByUID ¶
func (*UserGroups) ExistByName ¶
func (*UserGroups) GetAllNotFrozen ¶
func (a *UserGroups) GetAllNotFrozen(tx *gorm.DB) ([]UserGroups, error)
func (*UserGroups) GetGetUserGroupIdsByUID ¶
func (a *UserGroups) GetGetUserGroupIdsByUID(tx *gorm.DB) ([]uint, error)
func (*UserGroups) GetUserGroupNamesByUID ¶
func (a *UserGroups) GetUserGroupNamesByUID(tx *gorm.DB) ([]string, error)
func (*UserGroups) GetUserGroupsForAppCodeByUID ¶
func (*UserGroups) GetUserGroupsForShowByUID ¶
func (*UserGroups) GetUserGroupsLimited ¶
GetUserGroupsLimited 根据指定组范围获取用户所在组
func (*UserGroups) InsertAll ¶
func (a *UserGroups) InsertAll(tx *gorm.DB, data []UserGroups) error
type UserSsh ¶
type UserSsh struct { ID uint `gorm:"primarykey"` // User.ID UID uint `gorm:"uniqueIndex;not null;column:uid;"` User *User `gorm:"foreignKey:UID;constraint:OnDelete:RESTRICT"` PublicPem string `gorm:"not null"` PrivatePem string `gorm:"not null"` PublicSsh string `gorm:"not null"` PrivateSsh string `gorm:"not null"` }
func (*UserSsh) GetInvalid ¶
GetInvalid 获取应该清除的 user ssh
type UserWebauthn ¶
type UserWebauthn struct { ID uint `gorm:"primarykey"` CreatedAt int LastUsedAt int UID uint `gorm:"index;not null;column:uid"` User *User `gorm:"foreignKey:UID;constraint:OnDelete:CASCADE"` CredID string `gorm:"not null;index;type:varchar(255)"` Name string `gorm:"type:varchar(30)"` // 设备名 Credential string `gorm:"not null"` // json marshaled }
func (*UserWebauthn) GetByUidForShow ¶
func (a *UserWebauthn) GetByUidForShow(tx *gorm.DB) ([]dto.UserCredential, error)
func (*UserWebauthn) UpdateLastUsedAt ¶
func (a *UserWebauthn) UpdateLastUsedAt(tx *gorm.DB) *gorm.DB
func (*UserWebauthn) UpdatesByID ¶
func (a *UserWebauthn) UpdatesByID(tx *gorm.DB) error
Click to show internal directories.
Click to hide internal directories.