golang

package
v0.0.0-...-06e4aab Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Error = errors.NewClass("golang")

Functions

This section is empty.

Types

type ConditionArg

type ConditionArg struct {
	Var         *Var
	IsCondition bool
	Condition   int
	Underlying  UnderlyingType
}

func ConditionArgsFromWheres

func ConditionArgsFromWheres(wheres []*ir.Where) (out []ConditionArg)

type Create

type Create struct {
	Info                  sqlembedgo.Info
	Replace               bool
	Suffix                string
	Struct                *ModelStruct
	Return                *Var
	Args                  []*Var
	RequiredArgs          []*Var
	StaticFields          []*Var
	SupportsDefaultValues bool
	NeedsNow              bool
}

func CreateFromIR

func CreateFromIR(ir_cre *ir.Create, dialect sql.Dialect) *Create

type Delete

type Delete struct {
	Args   []ConditionArg
	Info   sqlembedgo.Info
	Suffix string
	Result *Var
}

func DeleteFromIR

func DeleteFromIR(ir_del *ir.Delete, dialect sql.Dialect) *Delete

type Field

type Field struct {
	Name string
	Type string
	Tags []Tag
}

type Get

type Get struct {
	Args         []ConditionArg
	Info         sqlembedgo.Info
	Suffix       string
	Row          *Var
	FirstInfo    sqlembedgo.Info
	Continuation *Var

	SupportsTupleComparison bool
}

func GetFromIR

func GetFromIR(ir_read *ir.Read, dialect sql.Dialect) *Get

type ModelField

type ModelField struct {
	Name       string
	ModelName  string
	Type       string
	Underlying UnderlyingType
	CtorValue  string
	MutateFn   string
	Column     string
	Nullable   bool
	Default    string
	Insertable bool
	AutoInsert bool
	Updatable  bool
	AutoUpdate bool
	TakeAddr   bool
}

func ModelFieldFromIR

func ModelFieldFromIR(field *ir.Field) *ModelField

func ModelFieldsFromIR

func ModelFieldsFromIR(fields []*ir.Field) (out []*ModelField)

func (*ModelField) ArgType

func (f *ModelField) ArgType() string

func (*ModelField) InsertableDynamic

func (f *ModelField) InsertableDynamic() bool

func (*ModelField) InsertableOptional

func (f *ModelField) InsertableOptional() bool

func (*ModelField) InsertableRequired

func (f *ModelField) InsertableRequired() bool

func (*ModelField) InsertableStatic

func (f *ModelField) InsertableStatic() bool

func (*ModelField) StructName

func (f *ModelField) StructName() string

type ModelStruct

type ModelStruct struct {
	Name   string
	Table  string
	Fields []*ModelField
}

Struct is used for generating go structures

func ModelStructFromIR

func ModelStructFromIR(model *ir.Model) *ModelStruct

func ModelStructsFromIR

func ModelStructsFromIR(models []*ir.Model) (out []*ModelStruct)

func (*ModelStruct) CreateStructName

func (s *ModelStruct) CreateStructName() string

func (*ModelStruct) InsertableDynamicFields

func (s *ModelStruct) InsertableDynamicFields() (fields []*ModelField)

func (*ModelStruct) InsertableOptionalFields

func (s *ModelStruct) InsertableOptionalFields() (fields []*ModelField)

func (*ModelStruct) InsertableRequiredFields

func (s *ModelStruct) InsertableRequiredFields() (fields []*ModelField)

func (*ModelStruct) InsertableStaticFields

func (s *ModelStruct) InsertableStaticFields() (fields []*ModelField)

func (*ModelStruct) UpdatableFields

func (s *ModelStruct) UpdatableFields() (fields []*ModelField)

func (*ModelStruct) UpdateStructName

func (s *ModelStruct) UpdateStructName() string

type Options

type Options struct {
	Package         string
	SupportUserdata bool
}

type RawCreate

type RawCreate struct {
	Info    sqlembedgo.Info
	Replace bool
	Suffix  string
	Return  *Var
	Arg     *Var
	Fields  []*Var
}

func RawCreateFromIR

func RawCreateFromIR(ir_cre *ir.Create, dialect sql.Dialect) *RawCreate

type Renderer

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

func New

func New(loader tmplutil.Loader, options *Options) (r *Renderer, err error)

func (*Renderer) LoadTemplate

func (r *Renderer) LoadTemplate(name string, dialect string) (*template.Template, error)

func (*Renderer) RenderCode

func (r *Renderer) RenderCode(root *ir.Root, dialects []sql.Dialect) (rendered []byte, err error)

type Struct

type Struct struct {
	Name   string
	Fields []Field
}

func ContinuationStructFromRead

func ContinuationStructFromRead(ir_read *ir.Read) *Struct

func ResultStructFromRead

func ResultStructFromRead(ir_read *ir.Read) *Struct

func StructFromVar

func StructFromVar(v *Var) *Struct

type Tag

type Tag struct {
	Key   string
	Value string
}

type UnderlyingType

type UnderlyingType struct {
	Type     consts.FieldType
	Nullable bool
}

type Update

type Update struct {
	Args       []ConditionArg
	Info       sqlembedgo.Info
	Suffix     string
	Struct     *ModelStruct
	Return     *Var
	AutoFields []*Var
	NeedsNow   bool
}

func UpdateFromIR

func UpdateFromIR(ir_upd *ir.Update, dialect sql.Dialect) *Update

type Var

type Var struct {
	Name       string
	Type       string
	Underlying UnderlyingType
	ZeroVal    string
	InitVal    string
	Fields     []*Var
}

func ArgFromField

func ArgFromField(field *ir.Field) *Var

func GetRowFromIR

func GetRowFromIR(ir_read *ir.Read) *Var

func MakeContinuationVar

func MakeContinuationVar(ir_read *ir.Read) *Var

func MakeResultVar

func MakeResultVar(selectables []ir.Selectable) *Var

func StructVar

func StructVar(name string, typ string, vars []*Var) *Var

func VarFromField

func VarFromField(field *ir.Field) *Var

func VarFromModel

func VarFromModel(model *ir.Model) *Var

func VarFromSelectable

func VarFromSelectable(selectable ir.Selectable, full_name bool) (v *Var)

func VarsFromFields

func VarsFromFields(fields []*ir.Field) (vars []*Var)

func VarsFromSelectables

func VarsFromSelectables(selectables []ir.Selectable) (vars []*Var)

func (*Var) AddrOf

func (v *Var) AddrOf() string

func (*Var) Arg

func (v *Var) Arg() string

func (*Var) Copy

func (v *Var) Copy() *Var

func (*Var) Declare

func (v *Var) Declare() string

func (*Var) Flatten

func (v *Var) Flatten() (flattened []*Var)

func (*Var) Init

func (v *Var) Init() string

func (*Var) InitNew

func (v *Var) InitNew() string

func (*Var) IsStruct

func (v *Var) IsStruct() bool

func (*Var) Param

func (v *Var) Param() string

func (*Var) SliceOf

func (v *Var) SliceOf() string

func (*Var) Value

func (v *Var) Value() string

func (*Var) Zero

func (v *Var) Zero() string

Jump to

Keyboard shortcuts

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