golang

package
v1.19.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SQLPackagePGXV4    string = "pgx/v4"
	SQLPackagePGXV5    string = "pgx/v5"
	SQLPackageStandard string = "database/sql"
)
View Source
const SQLDriverGoSQLDriverMySQL = "github.com/go-sql-driver/mysql"

Variables

View Source
var IdentPattern = regexp.MustCompile("[^a-zA-Z0-9_]+")

Functions

func EnumReplace

func EnumReplace(value string) string

func EnumValueName

func EnumValueName(value string) string

func JSONTagName added in v1.8.0

func JSONTagName(name string, settings *plugin.Settings) string

func SetCaseStyle added in v1.8.0

func SetCaseStyle(name string, style string) string

func SetJSONCaseStyle added in v1.19.0

func SetJSONCaseStyle(name string, style string, idUppercase bool) string

func StructName

func StructName(name string, settings *plugin.Settings) string

func TagsToString added in v1.19.0

func TagsToString(tags map[string]string) string

Types

type Constant

type Constant struct {
	Name  string
	Type  string
	Value string
}

type Enum

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

func (Enum) NameTag added in v1.19.0

func (e Enum) NameTag() string

func (Enum) ValidTag added in v1.19.0

func (e Enum) ValidTag() string

type Field

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

func (Field) HasSqlcSlice added in v1.18.0

func (gf Field) HasSqlcSlice() bool

func (Field) Tag

func (gf Field) Tag() string

type ImportSpec added in v1.6.0

type ImportSpec struct {
	ID   string
	Path string
}

func (ImportSpec) String added in v1.6.0

func (s ImportSpec) String() string

type Query

type Query struct {
	Cmd          string
	Comments     []string
	MethodName   string
	FieldName    string
	ConstantName string
	SQL          string
	SourceName   string
	Ret          QueryValue
	Arg          QueryValue
	// Used for :copyfrom
	Table *plugin.Identifier
}

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

func (Query) TableIdentifier added in v1.12.0

func (q Query) TableIdentifier() string

type QueryValue

type QueryValue struct {
	Emit        bool
	EmitPointer bool
	Name        string
	DBName      string // The name of the field in the database. Only set if Struct==nil.
	Struct      *Struct
	Typ         string
	SQLDriver   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 added in v1.12.0

func (v QueryValue) ColumnNames() string

func (*QueryValue) DefineType added in v1.11.0

func (v *QueryValue) DefineType() string

func (QueryValue) EmitStruct

func (v QueryValue) EmitStruct() bool

func (QueryValue) HasSqlcSlices added in v1.18.0

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) IsPointer added in v1.11.0

func (v QueryValue) IsPointer() bool

func (QueryValue) IsStruct

func (v QueryValue) IsStruct() bool

func (QueryValue) Pair

func (v QueryValue) Pair() string

func (QueryValue) Params

func (v QueryValue) Params() string

func (*QueryValue) ReturnName added in v1.11.0

func (v *QueryValue) ReturnName() string

func (QueryValue) Scan

func (v QueryValue) Scan() string

func (QueryValue) SlicePair added in v1.12.0

func (v QueryValue) SlicePair() string

func (QueryValue) Type

func (v QueryValue) Type() string

func (QueryValue) UniqueFields added in v1.11.0

func (v QueryValue) UniqueFields() []Field

func (QueryValue) VariableForField added in v1.19.0

func (v QueryValue) VariableForField(f Field) string

type SQLDriver added in v1.10.0

type SQLDriver int
const (
	SQLDriverPGXV4 SQLDriver = iota
	SQLDriverPGXV5
	SQLDriverLibPQ
)

func (SQLDriver) IsPGX added in v1.17.0

func (d SQLDriver) IsPGX() bool

func (SQLDriver) Package added in v1.17.0

func (d SQLDriver) Package() string

type Struct

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

Jump to

Keyboard shortcuts

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