Versions in this module Expand all Collapse all v1 v1.0.2 Aug 12, 2024 Changes in this version type WechatConfig + AgentID string v1.0.1 May 13, 2024 v1.0.0 May 12, 2024 Changes in this version + const CharStr + const NUmStr + const SpecStr + var DefaultPwd = "ABC123def" + func APIToPB(in *API) *apipb.APIInfo + func APIsToPB(in []API) []*apipb.APIInfo + func AddMenu(menu *Menu) error + func Authenticate(t, method, url string, checkAuth bool) (*apipb.CurrentUser, int, error) + func AutoMigrate() error + func BindPhone(userID string, phoneNuber string) error + func CheckRegisterWithWechat(openID string) (string, error) + func ClearCasbin(v int, p ...string) (bool, error) + func ConditionsToGormQuery(db *gorm.DB, conditions []string, combineType CombineType) *gorm.DB + func CopyTenant(id string) error + func CreateAPI(api *API) error + func CreateAPP(md *APP) error + func CreateDictionaries(m *Dictionaries) (string, error) + func CreateFormComponent(m *FormComponent) (string, error) + func CreateLanguage(m *Language) (string, error) + func CreateProject(m *Project) (string, error) + func CreateRole(newRole *Role) error + func CreateSystemConfig(m *SystemConfig) (string, error) + func CreateTenant(m *Tenant) error + func CreateUser(user *User, isCreateFromWechat bool) error + func CreateWebSite(m *WebSite) (string, error) + func CreateWechatConfig(m *WechatConfig) (string, error) + func DeleteAPP(id string) (err error) + func DeleteApi(id string) (err error) + func DeleteDictionaries(id string) (err error) + func DeleteFormComponent(id string) (err error) + func DeleteLanguage(id string) (err error) + func DeleteMenu(id string) (err error) + func DeleteProject(id string) (err error) + func DeleteRole(roleID string) (err error) + func DeleteSystemConfig(id string) (err error) + func DeleteTenant(id string) (err error) + func DeleteUser(id string) (err error) + func DeleteWebSite(id string) (err error) + func DeleteWechatConfig(id string) (err error) + func DictionariesArrayToPB(in []*Dictionaries) []*apipb.DictionariesInfo + func DictionariesToPB(in *Dictionaries) *apipb.DictionariesInfo + func EnableAPI(id string, enable bool) error + func EnableTenant(id string, enable bool) error + func EnableUser(id string, enable bool) error + func EncryptedPassword(password string) (string, error) + func ExportAllAPPs(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse) + func ExportAllApis(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse) + func ExportAllDictionaries(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse) + func ExportAllLanguages(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse) + func ExportAllMenus(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse) + func ExportAllProjects(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse) + func ExportAllRoles(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse) + func ExportAllSystemConfigs(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse) + func ExportAllTenants(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse) + func ExportAllUsers(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse) + func ExportAllWebSites(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse) + func ExportAllWechatConfigs(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse) + func FormComponentResourceToPB(in *FormComponentResource) *apipb.FormComponentResource + func FormComponentToPB(in *FormComponent) *apipb.FormComponentInfo + func FormComponentsToPB(in []*FormComponent) []*apipb.FormComponentInfo + func GetOpenIDByUserIDAndConfigID(userID, wechatConfigID string) (string, error) + func GetUserProfile(id string, needMenu bool) (*apipb.UserProfile, error) + func Init(connStr string, debug bool) + func InitCasbin() + func InitDB(client db.DBClientInterface, debug bool) + func InitSqlite(database string, debug bool) + func LanguageToPB(in *Language) *apipb.LanguageInfo + func LanguagesToPB(in []*Language) []*apipb.LanguageInfo + func Login(req *apipb.LoginRequest, resp *apipb.LoginResponse) + func LoginByStaffNo(req *apipb.LoginByStaffNoRequest, resp *apipb.LoginByStaffNoResponse) + func LoginByWechat(register bool, req *User, resp *apipb.LoginResponse) + func Logout(t string) error + func LogoutByUserName(req *apipb.LogoutByUserNameRequest, resp *apipb.CommonResponse) + func MenuFuncApisToPB(params []MenuFuncApi) []*apipb.MenuFuncApi + func MenuFuncsToPB(params []*MenuFunc) []*apipb.MenuFunc + func MenuParametersToPB(params []*MenuParameter) []*apipb.MenuParameter + func MenuToPB(in *Menu) *apipb.MenuInfo + func MenusToPB(in []*Menu) []*apipb.MenuInfo + func NewEnforcer() *casbin.Enforcer + func ParamsMatch(fullNameKey1 string, key2 string) bool + func ParamsMatchFunc(args ...interface{}) (interface{}, error) + func ProjectFormComponentToPB(in *ProjectFormComponent) *apipb.ProjectFormComponent + func ProjectFormComponentsToPB(in []*ProjectFormComponent) []*apipb.ProjectFormComponent + func ProjectToPB(in *Project) *apipb.ProjectInfo + func ProjectsToPB(in []*Project) []*apipb.ProjectInfo + func QueryAPI(req *apipb.QueryAPIRequest, resp *apipb.QueryAPIResponse) + func QueryAPP(req *QueryAPPRequest, resp *QueryAPPResponse) + func QueryDictionaries(req *apipb.QueryDictionariesRequest, resp *apipb.QueryDictionariesResponse, ...) + func QueryFormComponent(req *apipb.QueryFormComponentRequest, resp *apipb.QueryFormComponentResponse, ...) + func QueryLanguage(req *apipb.QueryLanguageRequest, resp *apipb.QueryLanguageResponse, ...) + func QueryMenu(req *apipb.QueryMenuRequest, resp *apipb.QueryMenuResponse, preload bool) + func QueryProject(req *apipb.QueryProjectRequest, resp *apipb.QueryProjectResponse, preload bool) + func QueryRole(req *apipb.QueryRoleRequest, resp *apipb.QueryRoleResponse, preload bool) + func QuerySystemConfig(req *apipb.QuerySystemConfigRequest, resp *apipb.QuerySystemConfigResponse, ...) + func QueryTenant(req *apipb.QueryTenantRequest, resp *apipb.QueryTenantResponse) + func QueryUser(req *apipb.QueryUserRequest, resp *apipb.QueryUserResponse, preload bool) + func QueryWebSite(req *apipb.QueryWebSiteRequest, resp *apipb.QueryWebSiteResponse, preload bool) + func QueryWechatConfig(req *apipb.QueryWechatConfigRequest, resp *apipb.QueryWechatConfigResponse, ...) + func ResetPwd(id string, pwd string) error + func RoleMenusToPB(roleMenus []*RoleMenu) []*apipb.RoleMenu + func RoleToPB(in *Role) *apipb.RoleInfo + func RolesToPB(in []*Role) []*apipb.RoleInfo + func SetDefaultPwd(defaultPwd string) + func StatisticRoleCount(tenantID string) (int64, error) + func StatisticTenantCount() (int64, error) + func StatisticUserCount(t int, tenantID, group string) (int64, error) + func SystemConfigToPB(in *SystemConfig) *apipb.SystemConfigInfo + func SystemConfigsToPB(in []*SystemConfig) []*apipb.SystemConfigInfo + func TenantCertificateToPB(in *TenantCertificate) *apipb.TenantCertificate + func TenantMenusToPB(tenantMenus []*TenantMenu) []*apipb.TenantMenu + func TenantToPB(in *Tenant) *apipb.TenantInfo + func TenantsToPB(in []*Tenant) []*apipb.TenantInfo + func TurnOffAutoMigrate(db *gorm.DB) + func UpdateAPI(api *API) error + func UpdateAPP(md *APP) error + func UpdateBasics(m *User) error + func UpdateCasbin(roleID string, casbinInfos []*CasbinRule) error + func UpdateCasbinApi(oldPath string, newPath string, oldMethod string, newMethod string) error + func UpdateDictionaries(m *Dictionaries) error + func UpdateFormComponent(m *FormComponent) error + func UpdateLanguage(m *Language) error + func UpdateMenu(menu *Menu) (err error) + func UpdateProfile(m *User, updateUserName bool) error + func UpdateProfileAndUserName(m *User) error + func UpdateProject(m *Project) error + func UpdateProjectAll(m *Project) error + func UpdatePwd(id string, oldPwd, newPwd string) error + func UpdateRole(newRole *Role) error + func UpdateSystemConfig(m *SystemConfig) error + func UpdateTenant(newTenant *Tenant) error + func UpdateUser(user *User) error + func UpdateUserAgeHeightWeight(m *User) error + func UpdateWebSite(m *WebSite) error + func UpdateWechatConfig(m *WechatConfig) error + func UserRolesToPB(userRoles []*UserRole) []*apipb.UserRole + func UserToPB(in *User) *apipb.UserInfo + func UserWechatOpenIDMapsToPB(maps []*UserWechatOpenIDMap) []*apipb.UserWechatOpenIDMap + func UsersToPB(in []*User) []*apipb.UserInfo + func ValidPasswdStrength(str string) bool + func WebSiteToPB(in *WebSite) *apipb.WebSiteInfo + func WebSitesToPB(in []*WebSite) []*apipb.WebSiteInfo + func WechatConfigToPB(in *WechatConfig) *apipb.WechatConfigInfo + func WechatConfigsToPB(in []*WechatConfig) []*apipb.WechatConfigInfo + type API struct + CheckAuth bool + CheckLogin bool + Description string + Enable bool + Group string + IsMust bool + Method string + Path string + ProjectID string + TenantID string + func GetAPIById(id string) (api API, err error) + func GetAllAPIs(req *apipb.QueryAPIRequest) (apis []API, err error) + func PBToAPI(in *apipb.APIInfo) *API + func (API) TableName() string + type APP struct + ActiveRule string + Container string + Credentials bool + Description string + DevEntry string + DisplayName string + Enable bool + Entry string + IsMust bool + Name string + PreEntry string + ProjectID string + Props []APPProp + TenantID string + TestEntry string + func GetAPPById(id string) (md APP, err error) + func GetAllAPPs() (mds []*APP, err error) + type APPProp struct + APPID uint + Key string + Value string + type Adapter struct + func NewAdapter(driverName string, dataSourceName string, params ...interface{}) (*Adapter, error) + func NewAdapterByDB(db *gorm.DB) (*Adapter, error) + func NewAdapterByDBUseTableName(db *gorm.DB, prefix string, tableName string) (*Adapter, error) + func NewAdapterByDBWithCustomTable(db *gorm.DB, t interface{}, tableName ...string) (*Adapter, error) + func NewAdapterByMulDb(dbPool DbPool, dbName string, prefix string, tableName string) (*Adapter, error) + func NewFilteredAdapter(driverName string, dataSourceName string, params ...interface{}) (*Adapter, error) + func NewFilteredAdapterByDB(db *gorm.DB, prefix string, tableName string) (*Adapter, error) + func (a *Adapter) AddLogger(l logger.Interface) + func (a *Adapter) AddPolicies(sec string, ptype string, rules [][]string) error + func (a *Adapter) AddPolicy(sec string, ptype string, rule []string) error + func (a *Adapter) AddPolicyCtx(ctx context.Context, sec string, ptype string, rule []string) error + func (a *Adapter) Close() error + func (a *Adapter) GetDb() *gorm.DB + func (a *Adapter) IsFiltered() bool + func (a *Adapter) LoadFilteredPolicy(model model.Model, filter interface{}) error + func (a *Adapter) LoadPolicy(model model.Model) error + func (a *Adapter) LoadPolicyCtx(ctx context.Context, model model.Model) error + func (a *Adapter) Open() error + func (a *Adapter) Preview(rules *[]CasbinRule, model model.Model) error + func (a *Adapter) RemoveFilteredPolicy(sec string, ptype string, fieldIndex int, fieldValues ...string) error + func (a *Adapter) RemoveFilteredPolicyCtx(ctx context.Context, sec string, ptype string, fieldIndex int, ...) error + func (a *Adapter) RemovePolicies(sec string, ptype string, rules [][]string) error + func (a *Adapter) RemovePoliciesCtx(ctx context.Context, sec string, ptype string, rules [][]string) error + func (a *Adapter) RemovePolicy(sec string, ptype string, rule []string) error + func (a *Adapter) RemovePolicyCtx(ctx context.Context, sec string, ptype string, rule []string) error + func (a *Adapter) SavePolicy(model model.Model) error + func (a *Adapter) SavePolicyCtx(ctx context.Context, model model.Model) error + func (a *Adapter) Transaction(e casbin.IEnforcer, fc func(casbin.IEnforcer) error, opts ...*sql.TxOptions) error + func (a *Adapter) UpdateFilteredPolicies(sec string, ptype string, newPolicies [][]string, fieldIndex int, ...) ([][]string, error) + func (a *Adapter) UpdatePolicies(sec string, ptype string, oldRules, newRules [][]string) error + func (a *Adapter) UpdatePolicy(sec string, ptype string, oldRule, newPolicy []string) error + type BatchFilter struct + type CasbinRule struct + CheckAuth string + ID uint + Method string + Path string + Ptype string + RoleID string + V4 string + V5 string + func GetPolicyPathByRoleID(roleID string) (pathMaps []*CasbinRule) + func (CasbinRule) TableName() string + type CheckRegisterWithWechatResp struct + Data bool + type CombineType uint32 + const CombineTypeAnd + const CombineTypeOr + type DbPool struct + func InitDbResolver(dbArr []gorm.Dialector, dbNames []string) (DbPool, error) + type Dictionaries struct + Description string + IsMust bool + Name string + ProjectID string + TenantID string + Type string + Value string + func GetAllDictionaries() (list []*Dictionaries, err error) + func GetDictionariesByID(id string) (*Dictionaries, error) + func GetDictionariesByIDs(ids []string) ([]*Dictionaries, error) + func PBToDictionaries(in []*apipb.DictionariesInfo) []*Dictionaries + func PBToDictionariesArray(in *apipb.DictionariesInfo) *Dictionaries + type Filter struct + Ptype []string + V0 []string + V1 []string + V2 []string + V3 []string + V4 []string + V5 []string + type FormComponent struct + Byo bool + Description string + DesignerLocales string + DesignerProps string + Extends string + Group string + Index int32 + Name string + Resource *FormComponentResource + Selector string + Title string + func GetFormComponentByID(id string) (*FormComponent, error) + func PBToFormComponent(in *apipb.FormComponentInfo) *FormComponent + func PBToFormComponents(in []*apipb.FormComponentInfo) []*FormComponent + type FormComponentResource struct + Description string + Elements string + FormComponentID string + Icon string + Span int32 + Thumb string + Title string + func PBToFormComponentResource(in *apipb.FormComponentResource) *FormComponentResource + type Language struct + Chinese string + Description string + English string + Group string + IsMust bool + Japan string + Name string + ProjectID string + System string + TenantID string + WebSiteID string + func GetAllLanguages() (list []*Language, err error) + func GetLanguageByID(id string) (*Language, error) + func GetLanguageByIDs(ids []string) ([]*Language, error) + func PBToLanguage(in *apipb.LanguageInfo) *Language + func PBToLanguages(in []*apipb.LanguageInfo) []*Language + type Menu struct + Cache bool + Children []*Menu + CloseTab bool + Component string + DefaultMenu bool + Hidden bool + Icon string + IsMust bool + Level uint32 + MenuFuncs []*MenuFunc + Name string + Parameters []*MenuParameter + ParentID string + Path string + ProjectID string + Sort int32 + TenantID string + Title string + func GetAllMenus(req *apipb.QueryMenuRequest) (menus []*Menu, err error) + func GetAuthorizedMenuTree(tenantID string) (list []*Menu, total int64, err error) + func GetAuthorizedMenu[T interface{ ... }](tx *gorm.DB, authiruzedMenu map[string]T, hidden bool) ([]*Menu, error) + func GetBaseMenuTree() (menus []*Menu, err error) + func GetMenuByID(id string) (*Menu, error) + func GetMenuTreeByRoleID(roleID string) (menus []*Menu, err error) + func PBToMenu(in *apipb.MenuInfo) *Menu + type MenuFunc struct + Hidden bool + MenuFuncApis []MenuFuncApi + MenuID string + Name string + Title string + func PBToMenuFuncs(params []*apipb.MenuFunc) []*MenuFunc + type MenuFuncApi struct + API *API + APIID string + MenuFuncID string + func PBToMenuFuncApis(params []*apipb.MenuFuncApi) []MenuFuncApi + type MenuParameter struct + Key string + MenuID string + Type string + Value string + func PBToMenuParameters(params []*apipb.MenuParameter) []*MenuParameter + type Project struct + CellCount int32 + Description string + Expired time.Time + FormComponents []*ProjectFormComponent + FormCount int32 + IsMust bool + Name string + PageCount int32 + TenantID string + func GetAllProjects() (list []*Project, err error) + func GetProjectByID(id string) (*Project, error) + func PBToProject(in *apipb.ProjectInfo) *Project + func PBToProjects(in []*apipb.ProjectInfo) []*Project + type ProjectFormComponent struct + Name string + ProjectID string + func PBToProjectFormComponent(in *apipb.ProjectFormComponent) *ProjectFormComponent + func PBToProjectFormComponents(in []*apipb.ProjectFormComponent) []*ProjectFormComponent + type PwdStrength int + const PwdStrengthAdvance + const PwdStrengthMix + const PwdStrengthOnliyChar + const PwdStrengthOnliyNumber + type QueryAPIRequest struct + CheckAuth int + CheckLogin int + Group string + Method string + Path string + type QueryAPIResponse struct + Data []API + type QueryAPPRequest struct + Enable int + IsMust bool + Name string + SortConfig string + type QueryAPPResponse struct + Data []*APP + type QueryUserRequest struct + IDCard string + Mobile string + Nickname string + Title string + UserName string + UserNames string + WechatID string + type QueryUserResponse struct + Data []*User + type Role struct + CanDel bool + Children []*Role + DefaultRouter string + Description string + IsMust bool + Name string + ParentID string + ProjectID string + Public bool + RoleMenus []*RoleMenu + Tenant *Tenant + TenantID string + func CopyRole(copyInfo RoleCopyResponse) (*Role, error) + func GetAllRole(tenantID string, containerCommon bool) (roles []*Role, err error) + func GetFullRoleByID(id string) (*Role, error) + func GetRoleByID(id string) (*Role, error) + func PBToRole(in *apipb.RoleInfo) *Role + type RoleCopyResponse struct + OldRoleID string + Role Role + type RoleMenu struct + Funcs string + Menu *Menu + MenuID string + RoleID string + Show bool + func GetMenuRole(roleID string) (menus []RoleMenu, err error) + func PBToRoleMenus(roleMenus []*apipb.RoleMenu) []*RoleMenu + func (r *RoleMenu) GetFuncs() []string + func (r *RoleMenu) GetMenuID() string + func (r *RoleMenu) GetShow() bool + type RoleResponse struct + Role Role + type SystemConfig struct + DefaultPwd string + EnableTenant bool + Expired string + IsMust bool + Key string + PlatformTenantID string + ProjectID string + RedisAddr string + RedisName string + RedisPwd string + SuperAdminRoleID string + TenantID string + func GetAllSystemConfigs() (list []*SystemConfig, err error) + func GetSystemConfigByID(id string) (*SystemConfig, error) + func GetSystemConfigByIDs(ids []string) ([]*SystemConfig, error) + func PBToSystemConfig(in *apipb.SystemConfigInfo) *SystemConfig + func PBToSystemConfigs(in []*apipb.SystemConfigInfo) []*SystemConfig + type Tenant struct + Address string + Area string + AreaCovered string + BusinessScope string + CellPhone string + Certificate *TenantCertificate + City string + Contact string + Enable bool + Expired time.Time + IsMust bool + Name string + ProjectCount int32 + Province string + RoleCount int32 + StaffSize int32 + TenantMenus []*TenantMenu + Town string + UserCount int32 + func GetAllTenant() (list []*Tenant, err error) + func GetTenantByID(id string) (*Tenant, error) + func PBToTenant(in *apipb.TenantInfo) *Tenant + type TenantCertificate struct + PrivateKey string + PublicKey string + TenantID string + func PBToTenantCertificate(in *apipb.TenantCertificate) *TenantCertificate + type TenantMenu struct + Funcs string + Menu *Menu + MenuID string + TenantID string + func PBToTenantMenus(tenantMenus []*apipb.TenantMenu) []*TenantMenu + func (r *TenantMenu) GetFuncs() []string + func (r *TenantMenu) GetMenuID() string + func (r *TenantMenu) GetShow() bool + type User struct + Age int32 + Avatar string + Birthday int64 + CanDel bool + ChangePwdErrNum int32 + ChangePwdLockedExpired int64 + ChineseName string + City string + Country string + County string + Description string + EID string + Email string + Enable bool + EnglishName string + ErrNumber int32 + Expired int64 + ForceChangePwd bool + Gender bool + Group string + Height float32 + IDCard string + IsMust bool + IsVip bool + LockedExpired int64 + Mobile string + Nickname string + Password string + ProjectID string + Province string + RealName string + RoleIDs []string + StaffNo string + Tenant *Tenant + Title string + Type int32 + UserName string + UserRoles []*UserRole + VipExpired time.Time + WechatConfigID string + WechatOpenID string + WechatOpenIDMaps []*UserWechatOpenIDMap + WechatUnionID string + Weight float32 + func GetAllUsers(req *apipb.GetAllUsersRequest) (users []*User, err error) + func GetUserById(id string) (user User, err error) + func PBToUser(in *apipb.UserInfo) *User + func UserProfileToUser(in *apipb.UserProfile) *User + func (u User) GetRoleIDs() []string + type UserProfile struct + Menus []*Menu + type UserRole struct + Role *Role + RoleID string + UserID string + func PBToUserRoles(userRoles []*apipb.UserRole) []*UserRole + type UserWechatOpenIDMap struct + OpenID string + UnionID string + UserID string + WechatConfigID string + func PBToUserWechatOpenIDMaps(maps []*apipb.UserWechatOpenIDMap) []*UserWechatOpenIDMap + type WebSite struct + Code string + IsMust bool + Logo string + Name string + ProjectID string + TenantID string + func GetAllWebSites() (list []*WebSite, err error) + func GetWebSiteByID(id string) (*WebSite, error) + func GetWebSiteByIDs(ids []string) ([]*WebSite, error) + func PBToWebSite(in *apipb.WebSiteInfo) *WebSite + func PBToWebSites(in []*apipb.WebSiteInfo) []*WebSite + type WechatConfig struct + AppID string + AppName string + AppType int32 + DefaultRoleID string + DisplayName string + EncodingAESKey string + EncodingMethod int32 + IsMust bool + ProjectID string + RedirectUrl string + Secret string + TenantID string + Token string + func GetAllWechatConfigs() (list []*WechatConfig, err error) + func GetWechatConfigByID(id string) (*WechatConfig, error) + func GetWechatConfigByIDs(ids []string) ([]*WechatConfig, error) + func PBToWechatConfig(in *apipb.WechatConfigInfo) *WechatConfig + func PBToWechatConfigs(in []*apipb.WechatConfigInfo) []*WechatConfig