types

package
v0.2.13 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultResultMapName = "BaseResultMap"
	DefaultBCLName       = "base_column_list"
)

Variables

This section is empty.

Functions

func GetJdbcTypePart

func GetJdbcTypePart(tps string) string

func GetShortName

func GetShortName(name string) string

func ParseJdbcTypeFrom

func ParseJdbcTypeFrom(tps string) reflect.Type

func ToJavaType

func ToJavaType(typ reflect.Type) string

func ToJson

func ToJson(v interface{}) string

func UpperFirst

func UpperFirst(s string) string

Types

type ColumnStucture added in v0.2.11

type ColumnStucture struct {
	Name    string
	Type    reflect.Type
	DbType  string
	Comment string
	Primary bool
}

type DatabaseStructure added in v0.2.11

type DatabaseStructure struct {
	Tables    []*TableStructure
	TableList []string
	TableMap  map[string]*TableStructure
}

func (*DatabaseStructure) SaveToDir added in v0.2.11

func (ds *DatabaseStructure) SaveToDir(dir, prefix, tables string) error

type QueryType

type QueryType string

type ResultItem

type ResultItem struct {
	Column     string
	Type       reflect.Type
	Property   string
	PrimaryKey bool
}

type ResultMap

type ResultMap struct {
	Id          string
	TypeName    string
	Results     []*ResultItem
	ColumnMap   map[string]*ResultItem
	PropertyMap map[string]*ResultItem
}

func (*ResultMap) GenerateFile

func (in *ResultMap) GenerateFile(dir, pkg string) error

type SqlElement

type SqlElement struct {
	Sql string
	Id  string
}

type SqlFunction

type SqlFunction struct {
	Id               string
	Owner            string
	Type             SqlFunctionType
	Param            SqlParam
	Result           SqlResult
	Items            []*sqlFragment
	TotalUsage       int64
	FailedUsage      int64
	TotalDuration    int64
	MaxDuration      int64
	MinDuration      int64
	GenerateCount    int64
	GenerateDuration int64
}

func (*SqlFunction) GenerateSQL

func (in *SqlFunction) GenerateSQL(args ...interface{}) (string, []interface{}, error)

GenerateSQL

func (*SqlFunction) PrepareSQL

func (in *SqlFunction) PrepareSQL(args ...interface{}) (string, []string, error)

func (*SqlFunction) String

func (in *SqlFunction) String() string

func (*SqlFunction) UpdateUsage

func (in *SqlFunction) UpdateUsage(start time.Time, success bool)

type SqlFunctionType

type SqlFunctionType string
const (
	SelectFunction SqlFunctionType = "select"
	UpdateFunction SqlFunctionType = "update"
	DeleteFunction SqlFunctionType = "delete"
	InsertFunction SqlFunctionType = "insert"
)

type SqlMapper

type SqlMapper struct {
	Filename       string
	Namespace      string
	Maps           []*ResultMap
	SqlNodes       []*SqlElement
	Functions      []*SqlFunction
	NamedMaps      map[string]*ResultMap
	NamedSqls      map[string]*SqlElement
	NamedFunctions map[string]*SqlFunction
}

func (*SqlMapper) GenerateFiles

func (in *SqlMapper) GenerateFiles(dir, pkg string)

type SqlMappers

type SqlMappers struct {
	Mappers      []SqlMapper
	NamedMappers map[string]*SqlMapper
}

func NewSqlMappers

func NewSqlMappers(dir string) *SqlMappers

func (*SqlMappers) GenerateFiles

func (in *SqlMappers) GenerateFiles(dir, pkg string)

type SqlParam

type SqlParam struct {
	Name     string
	TypeName string
	Type     SqlParamType
	Need     bool
}

type SqlParamType

type SqlParamType string
const (
	BaseSqlParam   SqlParamType = "base"
	SliceSqlParam  SqlParamType = "slice"
	MapSqlParam    SqlParamType = "map"
	StructSqlParam SqlParamType = "struct"
)

type SqlRenderer

type SqlRenderer interface {
	GenerateSQL(args ...interface{}) (string, error)
}

type SqlResult

type SqlResult struct {
	ResultM *ResultMap
	ResultT reflect.Type
}

type TableStructure added in v0.2.11

type TableStructure struct {
	Columns       []*ColumnStucture
	ColumnMap     map[string]*ColumnStucture
	Table         string
	PrimaryColumn *ColumnStucture
}

func NewTableStruct added in v0.2.11

func NewTableStruct(table string, res []map[string]interface{}) (*TableStructure, error)

Jump to

Keyboard shortcuts

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