golang

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnumReplace

func EnumReplace(value string) string

EnumReplace removes all non ident symbols (all but letters, numbers and underscore) and returns valid ident name for provided name.

func EnumValueName

func EnumValueName(value string) string

EnumValueName removes all non ident symbols (all but letters, numbers and underscore) and converts snake case ident to camel case.

func IsReserved

func IsReserved(s string) bool

func SetCaseStyle

func SetCaseStyle(name string, style string) string

func StructName

func StructName(name string, options *opts.Options) string

Types

type Argument

type Argument struct {
	Name string
	Type string
}

type Constant

type Constant struct {
	Name  string
	Type  string
	Value string
}

type Enum

type Enum struct {
	Name      string
	Comment   string
	Constants []Constant
}

type Field

type Field struct {
	Name    string // CamelCased name for Go
	DBName  string // Name as used in the DB
	Type    string
	Comment string
	Column  *plugin.Column
	// EmbedFields contains the embedded fields that require scanning.
	EmbedFields []Field
	Directive   string
}

func (Field) HasSqlcSlice

func (gf Field) HasSqlcSlice() bool

type GqlField

type GqlField struct {
	Name    string
	Type    string
	Comment string
}

type GqlStruct

type GqlStruct struct {
	Name    string
	Comment string
	Fields  []GqlField
}

type Query

type Query struct {
	Cmd          string
	Comments     []string
	MethodName   string
	SourceName   string
	ExtendedType string
	ResolverName string
	Directive    string
	Ret          QueryValue
	Arg          QueryValue

	Paginated        bool
	CursorPagination bool
}

A struct used to generate methods and fields on the Queries struct

func (Query) ReturnedType added in v0.2.1

func (q Query) ReturnedType() string

type QueryValue

type QueryValue struct {
	Emit      bool
	Name      string
	DBName    string // The name of the field in the database. Only set if Struct==nil.
	Struct    *Struct
	Typ       string
	ModelPath string
	SQLDriver opts.SQLDriver

	// Column is kept so late in the generation process around to differentiate
	// between mysql slices and pg arrays
	Column *plugin.Column
}

func (QueryValue) ColumnNames

func (v QueryValue) ColumnNames() []string

func (QueryValue) ColumnNamesAsGoSlice

func (v QueryValue) ColumnNamesAsGoSlice() string

func (QueryValue) CopyFromMySQLFields deprecated

func (v QueryValue) CopyFromMySQLFields() []Field

Deprecated: This method does not respect the Emit field set on the QueryValue. It's used by the go-sql-driver-mysql/copyfromCopy.tmpl and should not be used other places.

func (*QueryValue) DefineType

func (v *QueryValue) DefineType() string

func (QueryValue) EmitStruct

func (v QueryValue) EmitStruct() bool

func (QueryValue) HasSqlcSlices

func (v QueryValue) HasSqlcSlices() bool

When true, we have to build the arguments to q.db.QueryContext in addition to munging the SQL

func (QueryValue) IsStruct

func (v QueryValue) IsStruct() bool

func (QueryValue) Pair

func (v QueryValue) Pair() string

func (QueryValue) Pairs

func (v QueryValue) Pairs() []Argument

Return the argument name and type for query methods. Should only be used in the context of method arguments.

func (QueryValue) Params

func (v QueryValue) Params() string

func (*QueryValue) ReturnName

func (v *QueryValue) ReturnName() string

func (QueryValue) Scan

func (v QueryValue) Scan() string

func (QueryValue) SlicePair

func (v QueryValue) SlicePair() string

func (QueryValue) Type

func (v QueryValue) Type() string

func (QueryValue) UniqueFields

func (v QueryValue) UniqueFields() []Field

func (QueryValue) VariableForField

func (v QueryValue) VariableForField(f Field) string

type Struct

type Struct struct {
	Table     *plugin.Identifier
	Name      string
	Fields    []Field
	Comment   string
	ModelPath string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳