golang

package
v1.17.2 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 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"
)

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

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

func SetCaseStyle

func SetCaseStyle(name string, style string) string

func StructName

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

Types

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
	Tags    map[string]string
	Comment string
}

func (Field) Tag

func (gf Field) Tag() string

type ImportSpec

type ImportSpec struct {
	ID   string
	Path string
}

func (ImportSpec) String

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

func (q Query) TableIdentifier() string

type QueryValue

type QueryValue struct {
	Emit        bool
	EmitPointer bool
	Name        string
	Struct      *Struct
	Typ         string
	SQLDriver   SQLDriver
}

func (QueryValue) ColumnNames

func (v QueryValue) ColumnNames() string

func (*QueryValue) DefineType

func (v *QueryValue) DefineType() string

func (QueryValue) EmitStruct

func (v QueryValue) EmitStruct() bool

func (QueryValue) IsPointer

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

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

type SQLDriver

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

func (SQLDriver) IsPGX added in v1.17.2

func (d SQLDriver) IsPGX() bool

func (SQLDriver) Package added in v1.17.2

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