objs

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetName

func GetName(names []*ast.Ident) string

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) Parse

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

func (*Object) ParseFunc

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

type Type

type Type struct {
	Package 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 NewPtrTimeType

func NewPtrTimeType() *Type

func NewPtrType

func NewPtrType(pkg, name string) *Type

func NewPtrTypeByPkgAndName

func NewPtrTypeByPkgAndName(pkg, name string) *Type

func NewTimeType

func NewTimeType() *Type

func NewType

func NewType(pkg, name string) *Type

func NewTypeByExpr

func NewTypeByExpr(expr ast.Expr) *Type

func NewTypeByPkgAndName

func NewTypeByPkgAndName(pkg, name string) *Type

func NewTypeFromStructField

func NewTypeFromStructField(field *reflect.StructField) *Type

func ParseSelectorExprType

func ParseSelectorExprType(se *ast.SelectorExpr, ptr bool) *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) 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
	ERROR                      // error
	BLOB                       // BLOB 读写类型
	CUSTOM                     // 自定义类型
)

Jump to

Keyboard shortcuts

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