objs

package
v0.2.14 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseSQL

func ParseSQL(comment, dialect string) string

Types

type Object

type Object struct {
	Name      string // 名称
	Type      Type   // 类型
	Key       *Type  // map 时 key 的类型
	IsSlice   bool   // 是否数组
	IsMap     bool
	IsFunc    bool
	Params    []*Object
	Results   []*Object
	ParamsMap map[string]*Object
	Extra     interface{}
}

func NewEmptyObject

func NewEmptyObject() *Object

func NewObject

func NewObject(name string, typ Type) *Object

func NewObjectFromStructField

func NewObjectFromStructField(field *reflect.StructField) *Object

func (*Object) AddParam

func (o *Object) AddParam(obj *Object)

func (*Object) AddResult

func (o *Object) AddResult(obj *Object)

func (*Object) FindParam

func (o *Object) FindParam(names []string) *Object

func (*Object) GetSQLTypeByType

func (o *Object) GetSQLTypeByType() (st *types.SQLType)

func (*Object) IsTypeEqual

func (o *Object) IsTypeEqual(obj *Object) bool

func (*Object) Parse

func (o *Object) Parse(pkgPath string, field *ast.Field,
	expr ast.Expr,
	dialect string,
	fnFuncParseCb func(*Object) error,
	fnAddInterfacePackage func() (string, string),
	level int) error

func (*Object) ParseFunc

func (o *Object) ParseFunc(pkgPath string,
	params *ast.FieldList,
	results *ast.FieldList,
	dialect string,
	fnFuncParseCb func(*Object) error,
	fnAddInterfacePackage func() (string, string)) error

type Type

type Type struct {
	Package     string
	PackagePath string
	Name        string
	IsPtr       bool
	// contains filtered or unexported fields
}

func NewContextType

func NewContextType() *Type

func NewErrorType

func NewErrorType() *Type

func NewFuncType

func NewFuncType() *Type

func NewInterfaceType added in v0.1.5

func NewInterfaceType() *Type

func NewLimitType added in v0.2.14

func NewLimitType() *Type

func NewPtrTimeType

func NewPtrTimeType() *Type

func NewPtrTypeByPkgAndName

func NewPtrTypeByPkgAndName(pkg, name, pkgPath string, fnAddInterfacePackage func() (string, string)) *Type

func NewTimeType

func NewTimeType() *Type

func NewTypeByExpr

func NewTypeByExpr(pkgPath string, expr ast.Expr, fnAddInterfacePackage func() (string, string)) *Type

func NewTypeByPkgAndName

func NewTypeByPkgAndName(pkg, name, pkgPath string, fnAddInterfacePackage func() (string, string)) *Type

func NewTypeFromStructField

func NewTypeFromStructField(field *reflect.StructField) *Type

func ParseSelectorExprType

func ParseSelectorExprType(pkgPath string, se *ast.SelectorExpr, ptr bool, fnAddInterfacePackage func() (string, string)) *Type

func (*Type) Equals

func (typ *Type) Equals(t *Type) bool

Equals 判断是否相同类型,不区分是否指针

func (*Type) EqualsExactly

func (typ *Type) EqualsExactly(t *Type) bool

Equals 判断是否相同类型,包含是否指针

func (*Type) IsByte

func (typ *Type) IsByte() bool

func (*Type) IsContext

func (typ *Type) IsContext() bool

func (*Type) IsCustom

func (typ *Type) IsCustom() bool

func (*Type) IsError

func (typ *Type) IsError() bool

func (*Type) IsGenericInt

func (typ *Type) IsGenericInt() bool

func (*Type) IsInt64

func (typ *Type) IsInt64() bool

func (*Type) IsInterface added in v0.1.5

func (typ *Type) IsInterface() bool

func (*Type) IsLimit added in v0.2.14

func (typ *Type) IsLimit() bool

func (*Type) IsPrimitive

func (typ *Type) IsPrimitive() bool

func (*Type) IsTime

func (typ *Type) IsTime() bool

func (*Type) String

func (typ *Type) String() string

func (*Type) StringExt

func (typ *Type) StringExt() string

type TypeClass

type TypeClass int
const (
	PRIMITIVE TypeClass = iota // 基础类型
	FUNC                       // 函数
	TIME                       // 时间
	CONTEXT                    // context.Context
	LIMIT                      // rt.Limit
	ERROR                      // error
	BLOB                       // BLOB 读写类型
	INTERFACE                  // 函数
	CUSTOM                     // 自定义类型
)

Jump to

Keyboard shortcuts

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