korm

package module
v0.0.0-...-22a87af Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2023 License: MIT Imports: 16 Imported by: 0

README

korm

Documentation

Index

Constants

View Source
const (
	SqlTypeChar255  = "CHAR(255)"
	SqlTypeBigInt   = "bigint"
	SqlTypeLongBlob = "longblob"
	SqlTypeBool     = "bool"
)
View Source
const (
	InitModeMysql  = "mysql"
	InitModeSqlite = "sqlite"
)

Variables

This section is empty.

Functions

func BuildQueryStringCountExist

func BuildQueryStringCountExist(req BuildQueryStringCountExist_Req) string

func InitTable

func InitTable(req InitTableReq) (err error)

func MustCreateCode

func MustCreateCode(req MustCreateCode_Req)

func ScanCount

func ScanCount(result *sql.Rows) (cnt int64, err error)

func ScanExist

func ScanExist(result *sql.Rows) (exist bool, err error)

Types

type AddWhereAllField_Req

type AddWhereAllField_Req struct {
	// contains filtered or unexported fields
}

type BuildQueryStringCountExist_Req

type BuildQueryStringCountExist_Req struct {
	MainTableName       string
	MainTableNameAlias  string
	RootInfoBufLeftJoin *bytes.Buffer
	BufWhere            *bytes.Buffer
	IsExist             bool
}

type FieldSqlDefine

type FieldSqlDefine struct {
	Type         string
	Name         string
	IsPrimaryKey bool
}

type GoSourceWriter

type GoSourceWriter struct {
	// contains filtered or unexported fields
}

func (*GoSourceWriter) AddDeclear_ORM_Type

func (this *GoSourceWriter) AddDeclear_ORM_Type(info StructType)

func (*GoSourceWriter) AddFuncOrderBy

func (this *GoSourceWriter) AddFuncOrderBy(tName string, info StructType, isPointer bool)

func (*GoSourceWriter) AddFuncOrderByL1

func (this *GoSourceWriter) AddFuncOrderByL1(tName string, info StructType, isPointer bool, getTableNameAndFieldNameFn func(fn string) (tn string, fn2 string))

func (*GoSourceWriter) AddFunc_DbType

func (this *GoSourceWriter) AddFunc_DbType()

func (*GoSourceWriter) AddFunc_InitTable

func (this *GoSourceWriter) AddFunc_InitTable()

func (*GoSourceWriter) AddFunc_ORM_Create

func (this *GoSourceWriter) AddFunc_ORM_Create(info StructType)

func (*GoSourceWriter) AddFunc_ORM_Delete

func (this *GoSourceWriter) AddFunc_ORM_Delete(info StructType)

func (*GoSourceWriter) AddFunc_ORM_Query

func (this *GoSourceWriter) AddFunc_ORM_Query(info StructType)

func (*GoSourceWriter) AddFunc_ORM_Update

func (this *GoSourceWriter) AddFunc_ORM_Update(info StructType)

func (*GoSourceWriter) AddFunc_View_Select

func (this *GoSourceWriter) AddFunc_View_Select(info StructType)

func (*GoSourceWriter) AddFunc_fillSelectFieldNameList

func (this *GoSourceWriter) AddFunc_fillSelectFieldNameList(info StructType)

func (*GoSourceWriter) AddImportPath

func (this *GoSourceWriter) AddImportPath(importPath string)

func (*GoSourceWriter) AddImportPathHide

func (this *GoSourceWriter) AddImportPathHide(importPath string)

func (*GoSourceWriter) AddWhereAllField

func (this *GoSourceWriter) AddWhereAllField(info StructType, name string, isLeftJoinPart bool, needTableName bool)

func (*GoSourceWriter) AddWhereAllFieldL1

func (this *GoSourceWriter) AddWhereAllFieldL1(info StructType, name string, isLeftJoinPart bool, fnWField func(fieldName string) string)

func (*GoSourceWriter) ChangeLinkOpBegin

func (this *GoSourceWriter) ChangeLinkOpBegin(name string, op string, req AddWhereAllField_Req)

func (*GoSourceWriter) ChangeLinkOpEnd

func (this *GoSourceWriter) ChangeLinkOpEnd(name string, req AddWhereAllField_Req)

func (*GoSourceWriter) FiledOp_AddWhere

func (this *GoSourceWriter) FiledOp_AddWhere(name string, f StructFieldType, req AddWhereAllField_Req, fnWField func(fieldName string) string)

func (*GoSourceWriter) FormatWriteSrc

func (this *GoSourceWriter) FormatWriteSrc(to string)

func (*GoSourceWriter) GetImportList

func (this *GoSourceWriter) GetImportList() []string

func (*GoSourceWriter) MustParsePkg

func (this *GoSourceWriter) MustParsePkg(req MustCreateCode_Req)

type InitTableReq

type InitTableReq struct {
	Mode      string
	TableName string
	FieldList []FieldSqlDefine
	IndexList [][]string
	Db        *sql.DB
}

type KORM_leftJoinNode

type KORM_leftJoinNode struct {
	ThisLevelJoinList   []*KORM_leftJoinNode
	FieldName           string
	TableName           string // _0, _1, _2
	Root                *KORM_leftJoinRootInfo
	SelectFieldNameList []string
}

func (*KORM_leftJoinNode) AddLeftJoin

func (this *KORM_leftJoinNode) AddLeftJoin(rightTableName string, thisFieldName string, leftFieldName string, rightFieldName string) *KORM_leftJoinNode

func (*KORM_leftJoinNode) FillSelect

func (this *KORM_leftJoinNode) FillSelect(buf2 *bytes.Buffer, isFirst bool)

type KORM_leftJoinRootInfo

type KORM_leftJoinRootInfo struct {
	BufLeftJoin  bytes.Buffer
	TableNameIdx int
}

type MustCreateCode_Req

type MustCreateCode_Req struct {
	ModelPkgDir      string
	ModelPkgFullPath string
	ModelNameList    []string
	OutputFileName   string
	ImportExtList    []string
	GenMustFn        bool
}

type StructFieldType

type StructFieldType struct {
	FiledName        string
	TypeName         string
	IsStarExpr       bool
	IsPrimaryKeyPart bool
	LjField_This     string // left join
	LjFiled_Other    string // left join
	IndexList        [][]string
	ViewJoinPath     []string
}

func (*StructFieldType) GetSqlCreateTableDeclare

func (this *StructFieldType) GetSqlCreateTableDeclare() string

func (*StructFieldType) GetSqlDescDefaultV

func (this *StructFieldType) GetSqlDescDefaultV() string

func (StructFieldType) IsBoolType

func (t StructFieldType) IsBoolType() bool

func (StructFieldType) IsBuildinTimeType

func (this StructFieldType) IsBuildinTimeType() bool

func (StructFieldType) IsByteArrayType

func (t StructFieldType) IsByteArrayType() bool

func (StructFieldType) IsIntOrUintType

func (t StructFieldType) IsIntOrUintType() bool

func (StructFieldType) IsIntType

func (t StructFieldType) IsIntType() bool

func (StructFieldType) IsStringOrIntUintType

func (this StructFieldType) IsStringOrIntUintType() bool

func (StructFieldType) IsUintType

func (t StructFieldType) IsUintType() bool

func (StructFieldType) ViewGetJoinObjPath

func (this StructFieldType) ViewGetJoinObjPath() []string

func (StructFieldType) ViewGetJoinObjPath_LastBeLeftJoin

func (this StructFieldType) ViewGetJoinObjPath_LastBeLeftJoin(begin StructType, w *GoSourceWriter) string

func (StructFieldType) ViewGetJoinObj_CallDeclear

func (this StructFieldType) ViewGetJoinObj_CallDeclear() string

type StructType

type StructType struct {
	Name                 string
	FieldList            []StructFieldType
	IsView               bool
	ViewBeginD           string
	View_VarNameCallList [][2]string
	View_HasCallMap      map[string]string
}

func (*StructType) BuildQueryString

func (info *StructType) BuildQueryString(this *GoSourceWriter, ret string) string

func (*StructType) BuildQueryStringL1

func (info *StructType) BuildQueryStringL1(buf *bytes.Buffer, selectPrefixMysql string)

func (*StructType) BuildQueryStringOnConn

func (info *StructType) BuildQueryStringOnConn() string

func (StructType) GetDotName

func (t StructType) GetDotName() string

func (StructType) GetLeftJoinName

func (t StructType) GetLeftJoinName() string

func (StructType) GetOrmSubType_Delete

func (t StructType) GetOrmSubType_Delete() string

func (StructType) GetOrmSubType_SelectName

func (t StructType) GetOrmSubType_SelectName() string

func (StructType) GetOrmSubType_UpdateName

func (t StructType) GetOrmSubType_UpdateName() string

func (StructType) GetOrmTypeName

func (t StructType) GetOrmTypeName() string

func (StructType) View_getQueryNode_ByFieldName

func (info StructType) View_getQueryNode_ByFieldName(fn string) (nodeName string, fieldName2 string)

Jump to

Keyboard shortcuts

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