model

package
v0.9.34 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const TableNameTRobotInfo = "t_robot_info"

Variables

View Source
var (
	// Create action when record is created
	Create = Action(0)

	// RetrieveOne action when a record is retrieved from db
	RetrieveOne = Action(1)

	// RetrieveMany action when record(s) are retrieved from db
	RetrieveMany = Action(2)

	// Update action when record is updated in db
	Update = Action(3)

	// Delete action when record is deleted in db
	Delete = Action(4)

	// FetchDDL action when fetching ddl info from db
	FetchDDL = Action(5)
)

Functions

This section is empty.

Types

type Action

type Action int32

Action CRUD actions

func (Action) String

func (i Action) String() string

String describe the action

type Albums

type Albums struct {
	//[ 0] AlbumId                                        uint(64)             null: false  primary: true   isArray: false  auto: false  col: uint            len: 64      default: []
	AlbumID uint32 `gorm:"primary_key;column:AlbumId;type:uint;size:64;" json:"album_id"`
	//[ 1] Title                                          string(160)          null: true   primary: false  isArray: false  auto: false  col: string          len: 160     default: []
	Title string `gorm:"column:Title;type:string;size:160;" json:"title"`
	//[ 2] ArtistId                                       int(32)              null: false  primary: false  isArray: false  auto: false  col: int             len: 32      default: []
	ArtistID int32 `gorm:"column:ArtistId;type:int;size:32;" json:"artist_id"`
}

Albums struct is a row record of the albums table in the gormtest database

func (*Albums) BeforeSave

func (a *Albums) BeforeSave(tx *gorm.DB) error

BeforeSave invoked before saving, return an error if field is not populated.

func (*Albums) Prepare

func (a *Albums) Prepare()

Prepare invoked before saving, can be used to populate fields etc.

func (*Albums) TableName

func (a *Albums) TableName() string

TableName sets the insert table name for this struct type

func (*Albums) Validate

func (a *Albums) Validate(action Action) error

Validate invoked before performing action, return an error if field is not populated.

type Artists

type Artists struct {
	//[ 0] ArtistId                                       int(32)              null: false  primary: true   isArray: false  auto: false  col: int             len: 32      default: []
	ArtistID int32 `gorm:"primary_key;column:ArtistId;type:int;size:32;" json:"artist_id"`
	//[ 1] Name                                           string               null: true   primary: false  isArray: false  auto: false  col: string          len: 0       default: []
	Name string `gorm:"column:Name;type:string;" json:"name"`
}

Artists struct is a row record of the artists table in the gormtest database

func (*Artists) BeforeSave

func (a *Artists) BeforeSave(tx *gorm.DB) error

BeforeSave invoked before saving, return an error if field is not populated.

func (*Artists) Prepare

func (a *Artists) Prepare()

Prepare invoked before saving, can be used to populate fields etc.

func (*Artists) TableName

func (a *Artists) TableName() string

TableName sets the insert table name for this struct type

func (*Artists) Validate

func (a *Artists) Validate(action Action) error

Validate invoked before performing action, return an error if field is not populated.

type ColumnInfo

type ColumnInfo struct {
	Index              int    `json:"index"`
	GoFieldName        string `json:"go_field_name"`
	GoFieldType        string `json:"go_field_type"`
	JSONFieldName      string `json:"json_field_name"`
	ProtobufFieldName  string `json:"protobuf_field_name"`
	ProtobufType       string `json:"protobuf_field_type"`
	ProtobufPos        int    `json:"protobuf_field_pos"`
	Comment            string `json:"comment"`
	Notes              string `json:"notes"`
	Name               string `json:"name"`
	Nullable           bool   `json:"is_nullable"`
	DatabaseTypeName   string `json:"database_type_name"`
	DatabaseTypePretty string `json:"database_type_pretty"`
	IsPrimaryKey       bool   `json:"is_primary_key"`
	IsAutoIncrement    bool   `json:"is_auto_increment"`
	IsArray            bool   `json:"is_array"`
	ColumnType         string `json:"column_type"`
	ColumnLength       int64  `json:"column_length"`
	DefaultValue       string `json:"default_value"`
}

ColumnInfo describes a column in the database table

type Model

type Model interface {
	TableName() string
	BeforeSave() error
	Prepare()
	Validate(action Action) error
	TableInfo() *TableInfo
}

Model interface methods for database structs generated

type Orders

type Orders struct {
	//[ 0] id                                             bigint               null: false  primary: true   isArray: false  auto: true   col: bigint          len: -1      default: []
	ID int64 `gorm:"primary_key;AUTO_INCREMENT;column:id;type:bigint;" json:"id"`
	//[ 1] user_id                                        bigint               null: true   primary: false  isArray: false  auto: false  col: bigint          len: -1      default: []
	UserID int64 `gorm:"column:user_id;type:bigint;" json:"user_id"`
	//[ 2] product_id                                     bigint               null: true   primary: false  isArray: false  auto: false  col: bigint          len: -1      default: []
	ProductID int64 `gorm:"column:product_id;type:bigint;" json:"product_id"`
}

Orders struct is a row record of the orders table in the test database

func (*Orders) BeforeSave

func (o *Orders) BeforeSave(tx *gorm.DB) error

BeforeSave invoked before saving, return an error if field is not populated.

func (*Orders) Prepare

func (o *Orders) Prepare()

Prepare invoked before saving, can be used to populate fields etc.

func (*Orders) TableName

func (o *Orders) TableName() string

TableName sets the insert table name for this struct type

func (*Orders) Validate

func (o *Orders) Validate(action Action) error

Validate invoked before performing action, return an error if field is not populated.

type TRobotInfo

type TRobotInfo struct {
	//[ 0] FId                                            uint                 null: false  primary: true   isArray: false  auto: true   col: uint            len: -1      default: []
	FId uint32 `gorm:"primary_key;AUTO_INCREMENT;column:FId;type:int unsigned;" json:"f_id"`
	//[ 1] FRobotId                                       ubigint              null: false  primary: false  isArray: false  auto: false  col: ubigint         len: -1      default: []
	FRobotID uint64 `gorm:"column:FRobotId;type:bigint unsigned;" json:"f_robot_id"`
	//[ 2] FRobotAppId                                    varchar(256)         null: true   primary: false  isArray: false  auto: false  col: varchar         len: 256     default: []
	FRobotAppID string `gorm:"column:FRobotAppId;type:varchar(256);" json:"f_robot_app_id"`
	//[ 3] FRobotName                                     varchar(256)         null: true   primary: false  isArray: false  auto: false  col: varchar         len: 256     default: []
	FRobotName string `gorm:"column:FRobotName;type:varchar(256);" json:"f_robot_name"`
	//[ 4] FRobotAppkey                                   varchar(256)         null: true   primary: false  isArray: false  auto: false  col: varchar         len: 256     default: []
	FRobotAppkey string `gorm:"column:FRobotAppkey;type:varchar(256);" json:"f_robot_appkey"`
	//[ 5] FCorpUin                                       uint                 null: false  primary: false  isArray: false  auto: false  col: uint            len: -1      default: []
	FCorpUin uint32 `gorm:"column:FCorpUin;type:int unsigned;" json:"f_corp_uin"`
	//[ 6] FExtUin                                        uint                 null: true   primary: false  isArray: false  auto: false  col: uint            len: -1      default: []
	FExtUin uint32 `gorm:"column:FExtUin;type:int unsigned;" json:"f_ext_uin"`
	//[ 7] FRobotIcon                                     varchar(512)         null: true   primary: false  isArray: false  auto: false  col: varchar         len: 512     default: []
	FRobotIcon string `gorm:"column:FRobotIcon;type:varchar(512);" json:"f_robot_icon"`
	//[ 8] FRobotIconType                                 utinyint             null: false  primary: false  isArray: false  auto: false  col: utinyint        len: -1      default: [0]
	FRobotIconType uint32 `gorm:"column:FRobotIconType;type:tinyint;default:0;" json:"f_robot_icon_type"`
	//[ 9] FRobotIconIndex                                utinyint             null: false  primary: false  isArray: false  auto: false  col: utinyint        len: -1      default: [0]
	FRobotIconIndex uint32 `gorm:"column:FRobotIconIndex;type:tinyint;default:0;" json:"f_robot_icon_index"`
	//[10] FRobotCompany                                  uint                 null: false  primary: false  isArray: false  auto: false  col: uint            len: -1      default: [0]
	FRobotCompany uint32 `gorm:"column:FRobotCompany;type:int unsigned;default:0;" json:"f_robot_company"`
	//[11] FRobotIndustry                                 uint                 null: false  primary: false  isArray: false  auto: false  col: uint            len: -1      default: [0]
	FRobotIndustry uint32 `gorm:"column:FRobotIndustry;type:int unsigned;default:0;" json:"f_robot_industry"`
	//[12] FRobotIndustrySub                              uint                 null: false  primary: false  isArray: false  auto: false  col: uint            len: -1      default: [0]
	FRobotIndustrySub uint32 `gorm:"column:FRobotIndustrySub;type:int unsigned;default:0;" json:"f_robot_industry_sub"`
	//[13] FRobotCreateTime                               uint                 null: false  primary: false  isArray: false  auto: false  col: uint            len: -1      default: []
	FRobotCreateTime uint32 `gorm:"column:FRobotCreateTime;type:int unsigned;" json:"f_robot_create_time"`
	//[14] FRobotActiveFlg                                tinyint              null: false  primary: false  isArray: false  auto: false  col: tinyint         len: -1      default: [0]
	FRobotActiveFlg int32 `gorm:"column:FRobotActiveFlg;type:tinyint;default:0;" json:"f_robot_active_flg"`
	//[15] FRobotBubbleFlag                               ubigint              null: false  primary: false  isArray: false  auto: false  col: ubigint         len: -1      default: [0]
	FRobotBubbleFlag uint64 `gorm:"column:FRobotBubbleFlag;type:bigint unsigned;default:0;" json:"f_robot_bubble_flag"`
	//[16] FUpdateTime                                    timestamp            null: false  primary: false  isArray: false  auto: false  col: timestamp       len: -1      default: [CURRENT_TIMESTAMP]
	FUpdateTime time.Time `gorm:"column:FUpdateTime;type:timestamp;default:CURRENT_TIMESTAMP;" json:"f_update_time"`
	//[17] FThirdpartyAccount                             varchar(256)         null: true   primary: false  isArray: false  auto: false  col: varchar         len: 256     default: []
	FThirdpartyAccount string `gorm:"column:FThirdpartyAccount;type:varchar(256);" json:"f_thirdparty_account"`
	//[18] FRobotApiUrl                                   varchar(2048)        null: true   primary: false  isArray: false  auto: false  col: varchar         len: 2048    default: []
	FRobotAPIURL string `gorm:"column:FRobotApiUrl;type:varchar(2048);" json:"f_robot_api_url"`
	//[19] FRobotBid                                      varchar(256)         null: true   primary: false  isArray: false  auto: false  col: varchar         len: 256     default: []
	FRobotBid string `gorm:"column:FRobotBid;type:varchar(256);" json:"f_robot_bid"`
	//[20] FRobotEname                                    varchar(256)         null: true   primary: false  isArray: false  auto: false  col: varchar         len: 256     default: []
	FRobotEname string `gorm:"column:FRobotEname;type:varchar(256);" json:"f_robot_ename"`
	//[21] FRobotCname                                    varchar(256)         null: true   primary: false  isArray: false  auto: false  col: varchar         len: 256     default: []
	FRobotCname string `gorm:"column:FRobotCname;type:varchar(256);" json:"f_robot_cname"`
	//[22] FRobotCompanyAppid                             int                  null: true   primary: false  isArray: false  auto: false  col: int             len: -1      default: []
	FRobotCompanyAppid uint32 `gorm:"column:FRobotCompanyAppid;type:int;" json:"f_robot_company_appid"`
	//[23] FRobotCompanyUrl                               varchar(256)         null: true   primary: false  isArray: false  auto: false  col: varchar         len: 256     default: []
	FRobotCompanyURL string `gorm:"column:FRobotCompanyUrl;type:varchar(256);" json:"f_robot_company_url"`
	//[24] FRobotCompanyUseProxy                          utinyint             null: false  primary: false  isArray: false  auto: false  col: utinyint        len: -1      default: [0]
	FRobotCompanyUseProxy uint32 `gorm:"column:FRobotCompanyUseProxy;type:tinyint;default:0;" json:"f_robot_company_use_proxy"`
	//[25] FRobotProjectId                                varchar(256)         null: true   primary: false  isArray: false  auto: false  col: varchar         len: 256     default: []
	FRobotProjectID string `gorm:"column:FRobotProjectId;type:varchar(256);" json:"f_robot_project_id"`
	//[26] FRobotDomainId                                 varchar(256)         null: true   primary: false  isArray: false  auto: false  col: varchar         len: 256     default: []
	FRobotDomainID string `gorm:"column:FRobotDomainId;type:varchar(256);" json:"f_robot_domain_id"`
	//[27] FRobotDomainRepId                              varchar(256)         null: true   primary: false  isArray: false  auto: false  col: varchar         len: 256     default: []
	FRobotDomainRepID string `gorm:"column:FRobotDomainRepId;type:varchar(256);" json:"f_robot_domain_rep_id"`
	//[28] FRobotAppVersion                               varchar(256)         null: true   primary: false  isArray: false  auto: false  col: varchar         len: 256     default: []
	FRobotAppVersion string `gorm:"column:FRobotAppVersion;type:varchar(256);" json:"f_robot_app_version"`
	//[29] FRobotDomainTaskQaId                           varchar(256)         null: true   primary: false  isArray: false  auto: false  col: varchar         len: 256     default: []
	FRobotDomainTaskQaID string `gorm:"column:FRobotDomainTaskQaId;type:varchar(256);" json:"f_robot_domain_task_qa_id"`
	//[30] FRobotIsDelete                                 utinyint             null: false  primary: false  isArray: false  auto: false  col: utinyint        len: -1      default: [0]
	FRobotIsDelete uint32 `gorm:"column:FRobotIsDelete;type:tinyint;default:0;" json:"f_robot_is_delete"`
	//[31] FRobotDeclId                                   ubigint              null: false  primary: false  isArray: false  auto: false  col: ubigint         len: -1      default: [0]
	FRobotDeclID uint64 `gorm:"column:FRobotDeclId;type:bigint unsigned;default:0;" json:"f_robot_decl_id"`
	//[32] FRobotDomainGossipId                           varchar(256)         null: true   primary: false  isArray: false  auto: false  col: varchar         len: 256     default: []
	FRobotDomainGossipID string `gorm:"column:FRobotDomainGossipId;type:varchar(256);" json:"f_robot_domain_gossip_id"`
	//[33] FRobotCAppKey                                  varchar(255)         null: false  primary: false  isArray: false  auto: false  col: varchar         len: 255     default: []
	FRobotCAppKey string `gorm:"column:FRobotCAppKey;type:varchar(255);" json:"f_robot_c_app_key"`
	//[34] FRobotToken                                    varchar(255)         null: false  primary: false  isArray: false  auto: false  col: varchar         len: 255     default: []
	FRobotToken string `gorm:"column:FRobotToken;type:varchar(255);" json:"f_robot_token"`
}

TRobotInfos mapped from table <t_robot_info>

func (*TRobotInfo) BeforeSave

func (a *TRobotInfo) BeforeSave(tx *gorm.DB) error

BeforeSave invoked before saving, return an error if field is not populated.

func (*TRobotInfo) Prepare

func (a *TRobotInfo) Prepare()

Prepare invoked before saving, can be used to populate fields etc.

func (*TRobotInfo) TableName

func (*TRobotInfo) TableName() string

TableName TRobotInfo's table name

func (*TRobotInfo) Validate

func (a *TRobotInfo) Validate(action Action) error

Validate invoked before performing action, return an error if field is not populated.

type TableInfo

type TableInfo struct {
	Name    string        `json:"name"`
	Columns []*ColumnInfo `json:"columns"`
}

TableInfo describes a table in the database

Jump to

Keyboard shortcuts

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