golang

package
v1.10.6 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

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 Generate

func Generate(r *compiler.Result, settings config.CombinedSettings) (map[string]string, error)

func JSONTagName

func JSONTagName(name string, settings config.CombinedSettings) string

func SetCaseStyle

func SetCaseStyle(name string, style string) string

func StructName

func StructName(name string, settings config.CombinedSettings) 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
	Type    string
	Tags    map[string]string
	Comment string
}

func (Field) Tag

func (gf Field) Tag() string

type Generateable

type Generateable interface {
	Structs(settings config.CombinedSettings) []Struct
	GoQueries(settings config.CombinedSettings) []Query
	Enums(settings config.CombinedSettings) []Enum
}

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
}

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

type QueryValue

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

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) Type

func (v QueryValue) Type() string

func (QueryValue) UniqueFields added in v1.10.6

func (v QueryValue) UniqueFields() []Field

type SQLDriver

type SQLDriver int
const (
	SQLDriverPGXV4 SQLDriver = iota
	SQLDriverLibPQ
)

type SQLPackage

type SQLPackage string
const (
	SQLPackagePGX      SQLPackage = "pgx/v4"
	SQLPackageStandard SQLPackage = "database/sql"
)

func SQLPackageFromString

func SQLPackageFromString(s string) SQLPackage

type Struct

type Struct struct {
	Table   core.FQN
	Name    string
	Fields  []Field
	Comment string
}

Jump to

Keyboard shortcuts

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