Documentation ¶
Index ¶
- Variables
- type ApiType
- type Apis
- type Database
- type DbType
- type JSONMap
- func (jm JSONMap) GetFloat(key string) (float64, error)
- func (jm JSONMap) GetInt(key string) (int64, error)
- func (jm JSONMap) GetString(key string) (string, error)
- func (JSONMap) GormDBDataType(db *gorm.DB, field *schema.Field) string
- func (m JSONMap) GormDataType() string
- func (jm JSONMap) GormValue(ctx context.Context, db *gorm.DB) clause.Expr
- func (m JSONMap) MarshalJSON() ([]byte, error)
- func (jm JSONMap) MustGetString(key string) string
- func (m *JSONMap) Scan(val interface{}) error
- func (jm JSONMap) ToMapString() (map[string]string, error)
- func (m *JSONMap) UnmarshalJSON(b []byte) error
- func (m JSONMap) Value() (driver.Value, error)
- type Modelx
- type SqlType
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrKeyNotExist = errors.New("json map key not exist") ErrKeyKind = errors.New("json map value kind error") )
Functions ¶
This section is empty.
Types ¶
type Apis ¶
type Apis struct { Modelx DeletedAt soft_delete.DeletedAt `json:"deleteAt" gorm:"uniqueIndex:idx_api_name"` ApiType ApiType `json:"apiType" gorm:"column:api_type;default:'';not null;index"` Name string `json:"name" gorm:"column:api_name;type:varchar(200);uniqueIndex:idx_api_name;not null"` // api name Method string `json:"method" gorm:"column:method;type:varchar(50);not null;index"` // api name// http method Description string `json:"description" gorm:"column:description;type:varchar(200);not null"` // description SqlType SqlType `json:"sqlType" gorm:"column:sql_type;not null;index"` SqlTemplate JSONMap `json:"sqlTemplate" gorm:"column:sql_template;not null"` // sql template SqlTemplateParameters JSONMap `json:"sqlTemplateParameters" gorm:"column:sql_template_parameters;not null"` // template parameters SqlTemplateResult JSONMap `json:"sqlTemplateResult" gorm:"column:sql_template_result;not null"` // format result }
base sql template or sql chain
type Database ¶
type Database struct { Modelx DeletedAt soft_delete.DeletedAt `json:"deleteAt" gorm:"uniqueIndex:idx_db_key"` DBKey string `json:"dbKey" gorm:"column:db_key;type:varchar(200);uniqueIndex:idx_db_key;not null"` // db key desc Type DbType `json:"dbType" gorm:"column:db_type;not null;index"` Host string `json:"host" gorm:"column:host;type:varchar(100);not null"` Port int `json:"port" gorm:"column:port;not null"` User string `json:"user" gorm:"column:user;not null"` Password string `json:"password" gorm:"column:password;not null"` DBName string `json:"dbName" gorm:"column:db_name;not null"` }
TODO: db config
type JSONMap ¶
type JSONMap map[string]interface{}
JSONMap defiend JSON data type, need to implements driver.Valuer, sql.Scanner interface
func FromMapString ¶
func (JSONMap) GormDBDataType ¶
GormDBDataType gorm db data type
func (JSONMap) GormDataType ¶
GormDataType gorm common data type
func (JSONMap) MarshalJSON ¶
MarshalJSON to output non base64 encoded []byte
func (JSONMap) MustGetString ¶
func (*JSONMap) UnmarshalJSON ¶
UnmarshalJSON to deserialize []byte
Click to show internal directories.
Click to hide internal directories.