models

package
v1.7.10 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnnotationName = "name" //entityName
)

Variables

View Source
var BaseCrudInterface = NewInterfaceInfo("BaseCrudInterface", &Package{
	PackageInfo: PackageInfo{
		Name: "db_gorm",
		Path: "gitee.com/lipore/plume/db_gorm",
	},
})
View Source
var ErrMethodConflict = errors.New("method conflict")

Functions

This section is empty.

Types

type Annotation

type Annotation struct {
	Name  string
	Value string
}

func NewAnnotation

func NewAnnotation(annotationString string) *Annotation

type Annotations

type Annotations map[string]*Annotation

func NewAnnotations

func NewAnnotations() *Annotations

func (*Annotations) Get

func (a *Annotations) Get(name string) (*Annotation, bool)

func (*Annotations) Len

func (a *Annotations) Len() int

func (*Annotations) Set

func (a *Annotations) Set(name, value string)

func (*Annotations) Visit

func (a *Annotations) Visit(node ast.Node) ast.Visitor

type BiCondition

type BiCondition struct {
	Left     Condition
	Right    Condition
	Operator string
}

type Condition

type Condition interface {
}

func ParseCondition

func ParseCondition(c string) Condition

ParseCondition parse condition string to Condition

type EntityInfo

type EntityInfo struct {
	IdFields          []*FieldInfo
	DalStruct         *StructInfo
	DalDIYDoInterface *InterfaceInfo
	DalInterface      *InterfaceInfo
}

func NewEntityInfo

func NewEntityInfo(dalStru *StructInfo, diyDo *InterfaceInfo, pkg *Package) *EntityInfo

func (*EntityInfo) Column

func (e *EntityInfo) Column(name string) *FieldInfo

type FieldCondition

type FieldCondition struct {
	Field *FieldInfo
	IsNot bool
}

type FieldInfo

type FieldInfo struct {
	Name string
	Type string
	Tag  string
}

FieldInfo is the field info

type FieldsInfo

type FieldsInfo []*FieldInfo

func (*FieldsInfo) Visit

func (f *FieldsInfo) Visit(node ast.Node) ast.Visitor

type GenType

type GenType struct {
	Doc *ast.CommentGroup
	Pkg *Package
}

func NewGenType

func NewGenType(pkg *Package) *GenType

func (*GenType) Visit

func (m *GenType) Visit(n ast.Node) ast.Visitor

type Import

type Import struct {
	Name string
	Path string
}

func (*Import) Visit

func (i *Import) Visit(n ast.Node) ast.Visitor

type Imports

type Imports []*Import

type InterfaceInfo

type InterfaceInfo struct {
	Name            string
	Methods         []*MethodInfo
	Annotations     *Annotations
	ParentInterface *InterfaceInfo
	Package         *PackageInfo
}

InterfaceInfo is the interface info

func NewInterfaceInfo

func NewInterfaceInfo(name string, pkg *Package) *InterfaceInfo

func (*InterfaceInfo) AddMethod

func (i *InterfaceInfo) AddMethod(m *MethodInfo)

func (*InterfaceInfo) ExistMethod

func (i *InterfaceInfo) ExistMethod(n *MethodInfo) bool

func (*InterfaceInfo) FullName

func (i *InterfaceInfo) FullName() string

func (*InterfaceInfo) GetAnnotation

func (i *InterfaceInfo) GetAnnotation(name string) *Annotation

func (*InterfaceInfo) GetMethod

func (i *InterfaceInfo) GetMethod(name string) (*MethodInfo, bool)

func (*InterfaceInfo) ModelName

func (i *InterfaceInfo) ModelName() string

func (*InterfaceInfo) Visit

func (i *InterfaceInfo) Visit(node ast.Node) ast.Visitor

type InterfaceMethods

type InterfaceMethods []*MethodInfo

func (*InterfaceMethods) Visit

func (ms *InterfaceMethods) Visit(node ast.Node) ast.Visitor

type MethodInfo

type MethodInfo struct {
	Name     string
	RecvType string // must be nil for interface method
	Params   FieldsInfo
	Results  FieldsInfo
}

MethodInfo is the method info

func (*MethodInfo) Equal

func (m *MethodInfo) Equal(n *MethodInfo) bool

func (*MethodInfo) Visit

func (m *MethodInfo) Visit(n ast.Node) ast.Visitor

type Package

type Package struct {
	PackageInfo
	InterfaceInfos map[string]*InterfaceInfo
	StructInfos    map[string]*StructInfo
}

Package is the package info

func NewPackage

func NewPackage(name, path string) *Package

func (*Package) Visit

func (p *Package) Visit(node ast.Node) (w ast.Visitor)

type PackageInfo

type PackageInfo struct {
	Name    string
	Path    string
	Imports Imports
}

type StructInfo

type StructInfo struct {
	Name        string
	Fields      FieldsInfo
	Methods     []*MethodInfo
	Annotations *Annotations
	Package     *PackageInfo
}

StructInfo is the struct info

func NewStructInfo

func NewStructInfo(name string, pkg *Package) *StructInfo

func (*StructInfo) GetAnnotation

func (s *StructInfo) GetAnnotation(name string) *Annotation

func (*StructInfo) GetMethod

func (s *StructInfo) GetMethod(name string) (*MethodInfo, bool)

func (*StructInfo) ModelName

func (s *StructInfo) ModelName() string

ModelName return the name of the model of the DataObject

func (*StructInfo) Visit

func (s *StructInfo) Visit(node ast.Node) ast.Visitor

Jump to

Keyboard shortcuts

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