model

package
v0.0.0-...-9a50b96 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2024 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCurrentLevel

func GetCurrentLevel() sql_interface.ModelPermissions

获得当前权限等级

func GetLevel

func GetLevel(nick string, operationType int) sql_interface.ModelPermissions

获得数据等级

func GetMissingPrimaryKeyMessage

func GetMissingPrimaryKeyMessage() string

获得缺少主键消息

func GetPostDataErrorMessage

func GetPostDataErrorMessage() string

获得请求的数据错误消息

func GetQueryParameterErrorMessage

func GetQueryParameterErrorMessage() string

获得查询参数错误消息

Types

type AccountManager

type AccountManager struct {
	XMLName                     xml.Name     //顶层的账号管理器名称
	IncorrectPermissionsMessage string       //权限不正确错误消息
	AccountTableErrorMessage    string       //账号表配置错误消息
	AccountModel                AccountModel //账号模型
}

账号管理器

func GetAccountManager

func GetAccountManager() (*AccountManager, bool)

获得模型配置信息

type AccountModel

type AccountModel struct {
	Id             string                          //登录账号的唯一标识字段
	Password       string                          //登录账号的密码字段
	ValidaterArray []model_validater.DataValidater //验证器数组
	OperationArray []model_operation.DataOperator  //数据操作器
}

账号模型

type Field

type Field struct {
	Name         string //字段名
	Type         string //字段类型
	IsPrimaryKey bool   //是否是主键
	Create       string //创建类型
	Flag         int    //user-id: 1, user-password: 2
	TargetModel  string //关联的目标模型
	TargetField  string //关联的目标字段
}

字段

type Model

type Model struct {
	Nick             string                          //模型昵称
	TableName        string                          //表名
	ReadPermissions  sql_interface.ModelPermissions  //模型读权限
	WritePermissions sql_interface.ModelPermissions  //模型写权限
	FieldArray       []Field                         //字段数组
	ValidaterArray   []model_validater.DataValidater //验证器数组
	OperationArray   []model_operation.DataOperator  //数据操作器
	PrimaryKey       Field                           //主键字段
	ChildrenField    map[string]Field                //子模型对应的字段
}

模型

func GetModel

func GetModel(nick string) (Model, bool)

获得模型配置信息

type ModelConfig

type ModelConfig struct {
	ModelMap                   map[string]*Model //模型映射表
	MissingPrimaryKeyMessage   string            //缺少主键消息
	PostDataErrorMessage       string            //请求的数据错误消息
	QueryParameterErrorMessage string            //查询参数错误消息
	AccountModel               Model             //账号模型
	AdminModel                 Model             //管理员模型
	TokenModel                 Model             //token模型
}

模型配置结构

func LoadModelMap

func LoadModelMap(path string) *ModelConfig

加载模型映射表

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL