Documentation ¶
Index ¶
- Variables
- func DbStruct(name string) *dbStruct
- func GenerateDtos(writer io.Writer, def *Interface)
- func GenerateImplementation(writer io.Writer, def *Interface)
- func GenerateIntegrationTests(writer io.Writer, def *Interface)
- func GenerateInterface(writer io.Writer, def *Interface)
- func GenerateUnitTests(writer io.Writer, def *Interface)
- func GenerateValidations(writer io.Writer, def *Interface)
- func IsNil(val any) bool
- func KindOfPointer(kind string) string
- func KindOfSlice(kind string) string
- func KindOfT[T any]() string
- func KindOfTPointer[T any]() string
- func KindOfTSlice[T any]() string
- func PlainStruct(name string) *plainStruct
- func WriteCodeToFile(buffer *bytes.Buffer, fileName string)
- type DescriptionMappingKind
- type Field
- func (f *Field) DtoDecl() string
- func (f *Field) DtoKind() string
- func (f *Field) HasAnyValidationInSubtree() bool
- func (f *Field) IsPointer() bool
- func (f *Field) IsRoot() bool
- func (f *Field) IsSlice() bool
- func (f *Field) IsStruct() bool
- func (f *Field) KindNoPtr() string
- func (f *Field) KindNoSlice() string
- func (f *Field) Path() string
- func (f *Field) PathWithRoot() string
- func (f *Field) ShouldBeInDto() bool
- func (f *Field) TagsPrintable() string
- type FieldTransformer
- type IdentifierTransformer
- func (v *IdentifierTransformer) DoubleQuotes() *IdentifierTransformer
- func (v *IdentifierTransformer) Equals() *IdentifierTransformer
- func (v *IdentifierTransformer) NoEquals() *IdentifierTransformer
- func (v *IdentifierTransformer) Required() *IdentifierTransformer
- func (v *IdentifierTransformer) SQL(sqlPrefix string) *IdentifierTransformer
- func (v *IdentifierTransformer) SingleQuotes() *IdentifierTransformer
- func (v *IdentifierTransformer) Transform(f *Field) *Field
- type Interface
- func (i *Interface) AlterOperation(doc string, queryStruct *QueryStruct) *Interface
- func (i *Interface) CreateOperation(doc string, queryStruct *QueryStruct, helperStructs ...IntoField) *Interface
- func (i *Interface) CustomOperation(kind string, doc string, queryStruct *QueryStruct, helperStructs ...IntoField) *Interface
- func (i *Interface) DescribeOperation(describeKind DescriptionMappingKind, doc string, dbRepresentation *dbStruct, ...) *Interface
- func (i *Interface) DropOperation(doc string, queryStruct *QueryStruct) *Interface
- func (i *Interface) GrantOperation(doc string, queryStruct *QueryStruct) *Interface
- func (i *Interface) NameLowerCased() string
- func (i *Interface) RevokeOperation(doc string, queryStruct *QueryStruct) *Interface
- func (i *Interface) ShowByIdOperation() *Interface
- func (i *Interface) ShowOperation(doc string, dbRepresentation *dbStruct, resourceRepresentation *plainStruct, ...) *Interface
- type IntoField
- type KeywordTransformer
- func (v *KeywordTransformer) DoubleQuotes() *KeywordTransformer
- func (v *KeywordTransformer) MustParentheses() *KeywordTransformer
- func (v *KeywordTransformer) NoQuotes() *KeywordTransformer
- func (v *KeywordTransformer) Parentheses() *KeywordTransformer
- func (v *KeywordTransformer) Required() *KeywordTransformer
- func (v *KeywordTransformer) SQL(sqlPrefix string) *KeywordTransformer
- func (v *KeywordTransformer) SingleQuotes() *KeywordTransformer
- func (v *KeywordTransformer) Transform(f *Field) *Field
- type ListTransformer
- func (v *ListTransformer) MustParentheses() *ListTransformer
- func (v *ListTransformer) NoComma() *ListTransformer
- func (v *ListTransformer) NoEquals() *ListTransformer
- func (v *ListTransformer) NoParentheses() *ListTransformer
- func (v *ListTransformer) Parentheses() *ListTransformer
- func (v *ListTransformer) Required() *ListTransformer
- func (v *ListTransformer) SQL(sqlPrefix string) *ListTransformer
- func (v *ListTransformer) Transform(f *Field) *Field
- type Mapping
- type Operation
- type OperationKind
- type ParameterTransformer
- func (v *ParameterTransformer) ArrowEquals() *ParameterTransformer
- func (v *ParameterTransformer) DoubleQuotes() *ParameterTransformer
- func (v *ParameterTransformer) MustParentheses() *ParameterTransformer
- func (v *ParameterTransformer) NoEquals() *ParameterTransformer
- func (v *ParameterTransformer) NoParentheses() *ParameterTransformer
- func (v *ParameterTransformer) NoQuotes() *ParameterTransformer
- func (v *ParameterTransformer) Parentheses() *ParameterTransformer
- func (v *ParameterTransformer) Required() *ParameterTransformer
- func (v *ParameterTransformer) SQL(sqlPrefix string) *ParameterTransformer
- func (v *ParameterTransformer) SingleQuotes() *ParameterTransformer
- func (v *ParameterTransformer) Transform(f *Field) *Field
- type QueryStruct
- func (v *QueryStruct) Alter() *QueryStruct
- func (v *QueryStruct) Assignment(sqlPrefix string, kind string, transformer *ParameterTransformer) *QueryStruct
- func (v *QueryStruct) BodyWithPrecedingArrow() *QueryStruct
- func (v *QueryStruct) BooleanAssignment(sqlPrefix string, transformer *ParameterTransformer) *QueryStruct
- func (v *QueryStruct) Create() *QueryStruct
- func (v *QueryStruct) Describe() *QueryStruct
- func (v *QueryStruct) Drop() *QueryStruct
- func (v *QueryStruct) Grant() *QueryStruct
- func (v *QueryStruct) Identifier(fieldName string, kind string, transformer *IdentifierTransformer) *QueryStruct
- func (v *QueryStruct) IfExists() *QueryStruct
- func (v *QueryStruct) IfNotExists() *QueryStruct
- func (v *QueryStruct) IntoField() *Field
- func (v *QueryStruct) List(name string, itemKind string, transformer *ListTransformer) *QueryStruct
- func (v *QueryStruct) ListAssignment(sqlPrefix string, listItemKind string, transformer *ParameterTransformer) *QueryStruct
- func (v *QueryStruct) ListQueryStructField(name string, queryStruct *QueryStruct, transformer FieldTransformer) *QueryStruct
- func (v *QueryStruct) Name() *QueryStruct
- func (v *QueryStruct) NamedList(sql string, itemKind string) *QueryStruct
- func (v *QueryStruct) NamedListWithParens(sqlPrefix string, listItemKind string, transformer *KeywordTransformer) *QueryStruct
- func (v *QueryStruct) Number(name string, transformer *KeywordTransformer) *QueryStruct
- func (v *QueryStruct) NumberAssignment(sqlPrefix string, transformer *ParameterTransformer) *QueryStruct
- func (v *QueryStruct) OptionalAssignment(sqlPrefix string, kind string, transformer *ParameterTransformer) *QueryStruct
- func (v *QueryStruct) OptionalBooleanAssignment(sqlPrefix string, transformer *ParameterTransformer) *QueryStruct
- func (v *QueryStruct) OptionalComment() *QueryStruct
- func (v *QueryStruct) OptionalCopyGrants() *QueryStruct
- func (v *QueryStruct) OptionalIdentifier(name string, kind string, transformer *IdentifierTransformer) *QueryStruct
- func (v *QueryStruct) OptionalIdentifierAssignment(sqlPrefix string, identifierKind string, transformer *ParameterTransformer) *QueryStruct
- func (v *QueryStruct) OptionalIn() *QueryStruct
- func (v *QueryStruct) OptionalLike() *QueryStruct
- func (v *QueryStruct) OptionalLimit() *QueryStruct
- func (v *QueryStruct) OptionalLimitFrom() *QueryStruct
- func (v *QueryStruct) OptionalNumber(name string, transformer *KeywordTransformer) *QueryStruct
- func (v *QueryStruct) OptionalNumberAssignment(sqlPrefix string, transformer *ParameterTransformer) *QueryStruct
- func (v *QueryStruct) OptionalQueryStructField(name string, queryStruct *QueryStruct, transformer FieldTransformer) *QueryStruct
- func (v *QueryStruct) OptionalSQL(sql string) *QueryStruct
- func (v *QueryStruct) OptionalSessionParameters() *QueryStruct
- func (v *QueryStruct) OptionalSessionParametersUnset() *QueryStruct
- func (v *QueryStruct) OptionalSetBodyWithPrecedingArrow() *QueryStruct
- func (v *QueryStruct) OptionalSetTags() *QueryStruct
- func (v *QueryStruct) OptionalStartsWith() *QueryStruct
- func (v *QueryStruct) OptionalTags() *QueryStruct
- func (v *QueryStruct) OptionalText(name string, transformer *KeywordTransformer) *QueryStruct
- func (v *QueryStruct) OptionalTextAssignment(sqlPrefix string, transformer *ParameterTransformer) *QueryStruct
- func (v *QueryStruct) OptionalUnsetTags() *QueryStruct
- func (v *QueryStruct) OrReplace() *QueryStruct
- func (v *QueryStruct) PredefinedQueryStructField(name string, kind string, transformer FieldTransformer) *QueryStruct
- func (v *QueryStruct) QueryStructField(name string, queryStruct *QueryStruct, transformer FieldTransformer) *QueryStruct
- func (v *QueryStruct) Revoke() *QueryStruct
- func (v *QueryStruct) SQL(sql string) *QueryStruct
- func (v *QueryStruct) SetComment() *QueryStruct
- func (v *QueryStruct) SetTags() *QueryStruct
- func (v *QueryStruct) Show() *QueryStruct
- func (v *QueryStruct) Terse() *QueryStruct
- func (v *QueryStruct) Text(name string, transformer *KeywordTransformer) *QueryStruct
- func (v *QueryStruct) TextAssignment(sqlPrefix string, transformer *ParameterTransformer) *QueryStruct
- func (v *QueryStruct) UnsetTags() *QueryStruct
- func (v *QueryStruct) WithValidation(validationType ValidationType, fieldNames ...string) *QueryStruct
- type StaticTransformer
- type TagBuilder
- func (v *TagBuilder) Build() map[string][]string
- func (v *TagBuilder) DB(db ...string) *TagBuilder
- func (v *TagBuilder) DDL(ddl ...string) *TagBuilder
- func (v *TagBuilder) Identifier() *TagBuilder
- func (v *TagBuilder) Keyword() *TagBuilder
- func (v *TagBuilder) List() *TagBuilder
- func (v *TagBuilder) NoEquals() *TagBuilder
- func (v *TagBuilder) NoParentheses() *TagBuilder
- func (v *TagBuilder) Parameter() *TagBuilder
- func (v *TagBuilder) Parentheses() *TagBuilder
- func (v *TagBuilder) SQL(sql ...string) *TagBuilder
- func (v *TagBuilder) SingleQuotes() *TagBuilder
- func (v *TagBuilder) Static() *TagBuilder
- type Validation
- type ValidationType
Constants ¶
This section is empty.
Variables ¶
var (
PackageTemplate, _ = template.New("packageTemplates").Parse(packageTemplateContent)
InterfaceTemplate, _ = template.New("interfaceTemplate").Funcs(template.FuncMap{
"deref": func(p *DescriptionMappingKind) string { return string(*p) },
}).Parse(interfaceTemplateContent)
OperationStructTemplate, _ = template.New("optionsTemplate").Parse(operationStructTemplateContent)
StructTemplate, _ = template.New("structTemplate").Parse(structTemplateContent)
DtoTemplate, _ = template.New("dtoTemplate").Parse(dtoDeclarationsTemplateContent)
DtoDeclTemplate, _ = template.New("dtoTemplate").Parse(dtoStructsTemplateContent)
IntegrationTestsTemplate, _ = template.New("integrationTestsTemplate").Parse(integrationTestTemplateContent)
ImplementationTemplate *template.Template
UnitTestsTemplate *template.Template
ValidationsTemplate *template.Template
)
Functions ¶
func GenerateDtos ¶
func GenerateImplementation ¶
func GenerateInterface ¶
func GenerateUnitTests ¶
func GenerateValidations ¶
func IsNil ¶ added in v0.72.0
IsNil is used for special cases where x != nil might not work (e.g. passing nil instead of interface implementation)
func KindOfPointer ¶ added in v0.72.0
func KindOfSlice ¶ added in v0.72.0
func KindOfTPointer ¶ added in v0.72.0
func KindOfTSlice ¶ added in v0.72.0
func PlainStruct ¶ added in v0.72.0
func PlainStruct(name string) *plainStruct
func WriteCodeToFile ¶
Types ¶
type DescriptionMappingKind ¶ added in v0.72.0
type DescriptionMappingKind string
const ( DescriptionMappingKindSingleValue DescriptionMappingKind = "single_value" DescriptionMappingKindSlice DescriptionMappingKind = "slice" )
type Field ¶
type Field struct { // Parent allows to traverse fields hierarchy more easily, nil for root Parent *Field // Fields defines children, use for struct fields Fields []*Field // Validations defines validations on given field level (e.g. oneOf for children) Validations []*Validation // Name is how field is called in parent struct Name string // Kind is fields type (e.g. string, *bool) Kind string // Tags should contain ddl and sql tags used for SQL generation Tags map[string][]string // Required is used to mark fields which are essential (it's used e.g. for DTO builders generation) Required bool }
Field defines properties of a single field or struct (by defining Fields)
func NewField ¶
func NewField(name string, kind string, tagBuilder *TagBuilder, transformer FieldTransformer) *Field
func (*Field) DtoDecl ¶
DtoDecl returns how struct should be declared in generated DTO (e.g. definition is without a pointer)
func (*Field) DtoKind ¶
DtoKind returns what should be fields kind in generated DTO, because it may differ from Kind
func (*Field) HasAnyValidationInSubtree ¶
HasAnyValidationInSubtree checks if any validations are present from current field level downwards
func (*Field) IsRoot ¶
IsRoot checks if field is at the top of field hierarchy, basically it is true for Option structs
func (*Field) KindNoSlice ¶ added in v0.72.0
KindNoSlice return field's Kind but without array
func (*Field) Path ¶
Path returns the way through the tree to the top, with dot separator (e.g. .SomeField.SomeChild)
func (*Field) PathWithRoot ¶ added in v0.75.0
PathWithRoot returns the way through the tree to the top, with dot separator and root included (e.g. Struct.SomeField.SomeChild)
func (*Field) ShouldBeInDto ¶
ShouldBeInDto checks if field is not some static SQL field which should not be interacted with by SDK user TODO: this is a very naive implementation, consider fixing it with DSL builder connection
func (*Field) TagsPrintable ¶
TagsPrintable defines how tags are printed in options structs, it ensures the same order of tags for every field
type FieldTransformer ¶ added in v0.72.0
type IdentifierTransformer ¶ added in v0.72.0
type IdentifierTransformer struct {
// contains filtered or unexported fields
}
func IdentifierOptions ¶ added in v0.72.0
func IdentifierOptions() *IdentifierTransformer
func (*IdentifierTransformer) DoubleQuotes ¶ added in v0.72.0
func (v *IdentifierTransformer) DoubleQuotes() *IdentifierTransformer
func (*IdentifierTransformer) Equals ¶ added in v0.73.0
func (v *IdentifierTransformer) Equals() *IdentifierTransformer
func (*IdentifierTransformer) NoEquals ¶ added in v0.73.0
func (v *IdentifierTransformer) NoEquals() *IdentifierTransformer
func (*IdentifierTransformer) Required ¶ added in v0.72.0
func (v *IdentifierTransformer) Required() *IdentifierTransformer
func (*IdentifierTransformer) SQL ¶ added in v0.72.0
func (v *IdentifierTransformer) SQL(sqlPrefix string) *IdentifierTransformer
func (*IdentifierTransformer) SingleQuotes ¶ added in v0.72.0
func (v *IdentifierTransformer) SingleQuotes() *IdentifierTransformer
func (*IdentifierTransformer) Transform ¶ added in v0.72.0
func (v *IdentifierTransformer) Transform(f *Field) *Field
type Interface ¶
type Interface struct { // Name is the interface's name, e.g. "DatabaseRoles" Name string // NameSingular is the prefix/suffix which can be used to create other structs and methods, e.g. "DatabaseRole" NameSingular string // Operations contains all operations for given interface Operations []*Operation // IdentifierKind keeps identifier of the underlying object (e.g. DatabaseObjectIdentifier) IdentifierKind string }
Interface groups operations for particular object or objects family (e.g. DATABASE ROLE)
func NewInterface ¶
func (*Interface) AlterOperation ¶ added in v0.72.0
func (i *Interface) AlterOperation(doc string, queryStruct *QueryStruct) *Interface
func (*Interface) CreateOperation ¶ added in v0.72.0
func (i *Interface) CreateOperation(doc string, queryStruct *QueryStruct, helperStructs ...IntoField) *Interface
func (*Interface) CustomOperation ¶ added in v0.73.0
func (*Interface) DescribeOperation ¶ added in v0.72.0
func (i *Interface) DescribeOperation(describeKind DescriptionMappingKind, doc string, dbRepresentation *dbStruct, resourceRepresentation *plainStruct, queryStruct *QueryStruct) *Interface
func (*Interface) DropOperation ¶ added in v0.72.0
func (i *Interface) DropOperation(doc string, queryStruct *QueryStruct) *Interface
func (*Interface) GrantOperation ¶ added in v0.76.0
func (i *Interface) GrantOperation(doc string, queryStruct *QueryStruct) *Interface
func (*Interface) NameLowerCased ¶
NameLowerCased returns interface name starting with a lower case letter
func (*Interface) RevokeOperation ¶ added in v0.76.0
func (i *Interface) RevokeOperation(doc string, queryStruct *QueryStruct) *Interface
func (*Interface) ShowByIdOperation ¶ added in v0.73.0
func (*Interface) ShowOperation ¶ added in v0.72.0
func (i *Interface) ShowOperation(doc string, dbRepresentation *dbStruct, resourceRepresentation *plainStruct, queryStruct *QueryStruct) *Interface
type KeywordTransformer ¶ added in v0.72.0
type KeywordTransformer struct {
// contains filtered or unexported fields
}
func KeywordOptions ¶ added in v0.72.0
func KeywordOptions() *KeywordTransformer
func (*KeywordTransformer) DoubleQuotes ¶ added in v0.72.0
func (v *KeywordTransformer) DoubleQuotes() *KeywordTransformer
func (*KeywordTransformer) MustParentheses ¶ added in v0.82.0
func (v *KeywordTransformer) MustParentheses() *KeywordTransformer
func (*KeywordTransformer) NoQuotes ¶ added in v0.73.0
func (v *KeywordTransformer) NoQuotes() *KeywordTransformer
func (*KeywordTransformer) Parentheses ¶ added in v0.76.0
func (v *KeywordTransformer) Parentheses() *KeywordTransformer
func (*KeywordTransformer) Required ¶ added in v0.72.0
func (v *KeywordTransformer) Required() *KeywordTransformer
func (*KeywordTransformer) SQL ¶ added in v0.72.0
func (v *KeywordTransformer) SQL(sqlPrefix string) *KeywordTransformer
func (*KeywordTransformer) SingleQuotes ¶ added in v0.72.0
func (v *KeywordTransformer) SingleQuotes() *KeywordTransformer
func (*KeywordTransformer) Transform ¶ added in v0.72.0
func (v *KeywordTransformer) Transform(f *Field) *Field
type ListTransformer ¶ added in v0.72.0
type ListTransformer struct {
// contains filtered or unexported fields
}
func ListOptions ¶ added in v0.72.0
func ListOptions() *ListTransformer
func (*ListTransformer) MustParentheses ¶ added in v0.79.0
func (v *ListTransformer) MustParentheses() *ListTransformer
func (*ListTransformer) NoComma ¶ added in v0.76.0
func (v *ListTransformer) NoComma() *ListTransformer
func (*ListTransformer) NoEquals ¶ added in v0.73.0
func (v *ListTransformer) NoEquals() *ListTransformer
func (*ListTransformer) NoParentheses ¶ added in v0.74.0
func (v *ListTransformer) NoParentheses() *ListTransformer
func (*ListTransformer) Parentheses ¶ added in v0.74.0
func (v *ListTransformer) Parentheses() *ListTransformer
func (*ListTransformer) Required ¶ added in v0.72.0
func (v *ListTransformer) Required() *ListTransformer
func (*ListTransformer) SQL ¶ added in v0.72.0
func (v *ListTransformer) SQL(sqlPrefix string) *ListTransformer
func (*ListTransformer) Transform ¶ added in v0.72.0
func (v *ListTransformer) Transform(f *Field) *Field
type Operation ¶
type Operation struct { // Name is the operation's name, e.g. "Create" Name string // ObjectInterface points to the containing interface ObjectInterface *Interface // Doc is the URL for the doc used to create given operation, e.g. https://docs.snowflake.com/en/sql-reference/sql/create-database-role Doc string // OptsField defines opts used to create SQL for given operation OptsField *Field // HelperStructs are struct definitions that are not tied to OptsField, but tied to the Operation itself, e.g. Show() return type HelperStructs []*Field // ShowMapping is a definition of mapping needed by Operation kind of OperationKindShow ShowMapping *Mapping // DescribeKind defines a kind of mapping that needs to be performed in particular case of Describe implementation DescribeKind *DescriptionMappingKind // DescribeMapping is a definition of mapping needed by Operation kind of OperationKindDescribe DescribeMapping *Mapping }
Operation defines a single operation for given object or objects family (e.g. CREATE DATABASE ROLE)
type OperationKind ¶ added in v0.72.0
type OperationKind string
const ( OperationKindCreate OperationKind = "Create" OperationKindAlter OperationKind = "Alter" OperationKindDrop OperationKind = "Drop" OperationKindShow OperationKind = "Show" OperationKindShowByID OperationKind = "ShowByID" OperationKindDescribe OperationKind = "Describe" OperationKindGrant OperationKind = "Grant" OperationKindRevoke OperationKind = "Revoke" )
type ParameterTransformer ¶ added in v0.72.0
type ParameterTransformer struct {
// contains filtered or unexported fields
}
func ParameterOptions ¶ added in v0.72.0
func ParameterOptions() *ParameterTransformer
func (*ParameterTransformer) ArrowEquals ¶ added in v0.74.0
func (v *ParameterTransformer) ArrowEquals() *ParameterTransformer
func (*ParameterTransformer) DoubleQuotes ¶ added in v0.72.0
func (v *ParameterTransformer) DoubleQuotes() *ParameterTransformer
func (*ParameterTransformer) MustParentheses ¶ added in v0.84.0
func (v *ParameterTransformer) MustParentheses() *ParameterTransformer
func (*ParameterTransformer) NoEquals ¶ added in v0.73.0
func (v *ParameterTransformer) NoEquals() *ParameterTransformer
func (*ParameterTransformer) NoParentheses ¶ added in v0.73.0
func (v *ParameterTransformer) NoParentheses() *ParameterTransformer
func (*ParameterTransformer) NoQuotes ¶ added in v0.72.0
func (v *ParameterTransformer) NoQuotes() *ParameterTransformer
func (*ParameterTransformer) Parentheses ¶ added in v0.72.0
func (v *ParameterTransformer) Parentheses() *ParameterTransformer
func (*ParameterTransformer) Required ¶ added in v0.72.0
func (v *ParameterTransformer) Required() *ParameterTransformer
func (*ParameterTransformer) SQL ¶ added in v0.72.0
func (v *ParameterTransformer) SQL(sqlPrefix string) *ParameterTransformer
func (*ParameterTransformer) SingleQuotes ¶ added in v0.72.0
func (v *ParameterTransformer) SingleQuotes() *ParameterTransformer
func (*ParameterTransformer) Transform ¶ added in v0.72.0
func (v *ParameterTransformer) Transform(f *Field) *Field
type QueryStruct ¶ added in v0.72.0
type QueryStruct struct {
// contains filtered or unexported fields
}
TODO For Field abstractions use internal Field representation instead of copying only needed fields, e.g.
type QueryStruct struct { internalRepresentation *Field ...additional fields that are not present in the Field }
func NewQueryStruct ¶ added in v0.76.0
func NewQueryStruct(name string) *QueryStruct
func (*QueryStruct) Alter ¶ added in v0.76.0
func (v *QueryStruct) Alter() *QueryStruct
func (*QueryStruct) Assignment ¶ added in v0.76.0
func (v *QueryStruct) Assignment(sqlPrefix string, kind string, transformer *ParameterTransformer) *QueryStruct
func (*QueryStruct) BodyWithPrecedingArrow ¶ added in v0.84.0
func (v *QueryStruct) BodyWithPrecedingArrow() *QueryStruct
func (*QueryStruct) BooleanAssignment ¶ added in v0.76.0
func (v *QueryStruct) BooleanAssignment(sqlPrefix string, transformer *ParameterTransformer) *QueryStruct
func (*QueryStruct) Create ¶ added in v0.76.0
func (v *QueryStruct) Create() *QueryStruct
func (*QueryStruct) Describe ¶ added in v0.76.0
func (v *QueryStruct) Describe() *QueryStruct
func (*QueryStruct) Drop ¶ added in v0.76.0
func (v *QueryStruct) Drop() *QueryStruct
func (*QueryStruct) Grant ¶ added in v0.76.0
func (v *QueryStruct) Grant() *QueryStruct
func (*QueryStruct) Identifier ¶ added in v0.76.0
func (v *QueryStruct) Identifier(fieldName string, kind string, transformer *IdentifierTransformer) *QueryStruct
func (*QueryStruct) IfExists ¶ added in v0.76.0
func (v *QueryStruct) IfExists() *QueryStruct
func (*QueryStruct) IfNotExists ¶ added in v0.76.0
func (v *QueryStruct) IfNotExists() *QueryStruct
func (*QueryStruct) IntoField ¶ added in v0.76.0
func (v *QueryStruct) IntoField() *Field
func (*QueryStruct) List ¶ added in v0.76.0
func (v *QueryStruct) List(name string, itemKind string, transformer *ListTransformer) *QueryStruct
func (*QueryStruct) ListAssignment ¶ added in v0.76.0
func (v *QueryStruct) ListAssignment(sqlPrefix string, listItemKind string, transformer *ParameterTransformer) *QueryStruct
func (*QueryStruct) ListQueryStructField ¶ added in v0.76.0
func (v *QueryStruct) ListQueryStructField(name string, queryStruct *QueryStruct, transformer FieldTransformer) *QueryStruct
func (*QueryStruct) Name ¶ added in v0.76.0
func (v *QueryStruct) Name() *QueryStruct
Name adds identifier with field name "name" and type will be inferred from interface definition
func (*QueryStruct) NamedList ¶ added in v0.76.0
func (v *QueryStruct) NamedList(sql string, itemKind string) *QueryStruct
func (*QueryStruct) NamedListWithParens ¶ added in v0.76.0
func (v *QueryStruct) NamedListWithParens(sqlPrefix string, listItemKind string, transformer *KeywordTransformer) *QueryStruct
func (*QueryStruct) Number ¶ added in v0.76.0
func (v *QueryStruct) Number(name string, transformer *KeywordTransformer) *QueryStruct
func (*QueryStruct) NumberAssignment ¶ added in v0.76.0
func (v *QueryStruct) NumberAssignment(sqlPrefix string, transformer *ParameterTransformer) *QueryStruct
func (*QueryStruct) OptionalAssignment ¶ added in v0.76.0
func (v *QueryStruct) OptionalAssignment(sqlPrefix string, kind string, transformer *ParameterTransformer) *QueryStruct
func (*QueryStruct) OptionalBooleanAssignment ¶ added in v0.76.0
func (v *QueryStruct) OptionalBooleanAssignment(sqlPrefix string, transformer *ParameterTransformer) *QueryStruct
func (*QueryStruct) OptionalComment ¶ added in v0.76.0
func (v *QueryStruct) OptionalComment() *QueryStruct
func (*QueryStruct) OptionalCopyGrants ¶ added in v0.76.0
func (v *QueryStruct) OptionalCopyGrants() *QueryStruct
func (*QueryStruct) OptionalIdentifier ¶ added in v0.76.0
func (v *QueryStruct) OptionalIdentifier(name string, kind string, transformer *IdentifierTransformer) *QueryStruct
func (*QueryStruct) OptionalIdentifierAssignment ¶ added in v0.76.0
func (v *QueryStruct) OptionalIdentifierAssignment(sqlPrefix string, identifierKind string, transformer *ParameterTransformer) *QueryStruct
func (*QueryStruct) OptionalIn ¶ added in v0.76.0
func (v *QueryStruct) OptionalIn() *QueryStruct
func (*QueryStruct) OptionalLike ¶ added in v0.76.0
func (v *QueryStruct) OptionalLike() *QueryStruct
func (*QueryStruct) OptionalLimit ¶ added in v0.76.0
func (v *QueryStruct) OptionalLimit() *QueryStruct
func (*QueryStruct) OptionalLimitFrom ¶ added in v0.76.0
func (v *QueryStruct) OptionalLimitFrom() *QueryStruct
func (*QueryStruct) OptionalNumber ¶ added in v0.76.0
func (v *QueryStruct) OptionalNumber(name string, transformer *KeywordTransformer) *QueryStruct
func (*QueryStruct) OptionalNumberAssignment ¶ added in v0.76.0
func (v *QueryStruct) OptionalNumberAssignment(sqlPrefix string, transformer *ParameterTransformer) *QueryStruct
func (*QueryStruct) OptionalQueryStructField ¶ added in v0.76.0
func (v *QueryStruct) OptionalQueryStructField(name string, queryStruct *QueryStruct, transformer FieldTransformer) *QueryStruct
func (*QueryStruct) OptionalSQL ¶ added in v0.76.0
func (v *QueryStruct) OptionalSQL(sql string) *QueryStruct
func (*QueryStruct) OptionalSessionParameters ¶ added in v0.76.0
func (v *QueryStruct) OptionalSessionParameters() *QueryStruct
func (*QueryStruct) OptionalSessionParametersUnset ¶ added in v0.76.0
func (v *QueryStruct) OptionalSessionParametersUnset() *QueryStruct
func (*QueryStruct) OptionalSetBodyWithPrecedingArrow ¶ added in v0.84.0
func (v *QueryStruct) OptionalSetBodyWithPrecedingArrow() *QueryStruct
func (*QueryStruct) OptionalSetTags ¶ added in v0.76.0
func (v *QueryStruct) OptionalSetTags() *QueryStruct
func (*QueryStruct) OptionalStartsWith ¶ added in v0.76.0
func (v *QueryStruct) OptionalStartsWith() *QueryStruct
func (*QueryStruct) OptionalTags ¶ added in v0.76.0
func (v *QueryStruct) OptionalTags() *QueryStruct
func (*QueryStruct) OptionalText ¶ added in v0.76.0
func (v *QueryStruct) OptionalText(name string, transformer *KeywordTransformer) *QueryStruct
func (*QueryStruct) OptionalTextAssignment ¶ added in v0.76.0
func (v *QueryStruct) OptionalTextAssignment(sqlPrefix string, transformer *ParameterTransformer) *QueryStruct
func (*QueryStruct) OptionalUnsetTags ¶ added in v0.76.0
func (v *QueryStruct) OptionalUnsetTags() *QueryStruct
func (*QueryStruct) OrReplace ¶ added in v0.76.0
func (v *QueryStruct) OrReplace() *QueryStruct
func (*QueryStruct) PredefinedQueryStructField ¶ added in v0.76.0
func (v *QueryStruct) PredefinedQueryStructField(name string, kind string, transformer FieldTransformer) *QueryStruct
func (*QueryStruct) QueryStructField ¶ added in v0.76.0
func (v *QueryStruct) QueryStructField(name string, queryStruct *QueryStruct, transformer FieldTransformer) *QueryStruct
func (*QueryStruct) Revoke ¶ added in v0.76.0
func (v *QueryStruct) Revoke() *QueryStruct
func (*QueryStruct) SQL ¶ added in v0.76.0
func (v *QueryStruct) SQL(sql string) *QueryStruct
func (*QueryStruct) SetComment ¶ added in v0.76.0
func (v *QueryStruct) SetComment() *QueryStruct
func (*QueryStruct) SetTags ¶ added in v0.76.0
func (v *QueryStruct) SetTags() *QueryStruct
func (*QueryStruct) Show ¶ added in v0.76.0
func (v *QueryStruct) Show() *QueryStruct
func (*QueryStruct) Terse ¶ added in v0.76.0
func (v *QueryStruct) Terse() *QueryStruct
func (*QueryStruct) Text ¶ added in v0.76.0
func (v *QueryStruct) Text(name string, transformer *KeywordTransformer) *QueryStruct
func (*QueryStruct) TextAssignment ¶ added in v0.76.0
func (v *QueryStruct) TextAssignment(sqlPrefix string, transformer *ParameterTransformer) *QueryStruct
func (*QueryStruct) UnsetTags ¶ added in v0.76.0
func (v *QueryStruct) UnsetTags() *QueryStruct
func (*QueryStruct) WithValidation ¶ added in v0.76.0
func (v *QueryStruct) WithValidation(validationType ValidationType, fieldNames ...string) *QueryStruct
type StaticTransformer ¶ added in v0.84.0
type StaticTransformer struct {
// contains filtered or unexported fields
}
func StaticOptions ¶ added in v0.84.0
func StaticOptions() *StaticTransformer
func (*StaticTransformer) SQL ¶ added in v0.84.0
func (v *StaticTransformer) SQL(sqlPrefix string) *StaticTransformer
func (*StaticTransformer) Transform ¶ added in v0.84.0
func (v *StaticTransformer) Transform(f *Field) *Field
type TagBuilder ¶ added in v0.72.0
type TagBuilder struct {
// contains filtered or unexported fields
}
func Tags ¶ added in v0.72.0
func Tags() *TagBuilder
func (*TagBuilder) Build ¶ added in v0.72.0
func (v *TagBuilder) Build() map[string][]string
func (*TagBuilder) DB ¶ added in v0.72.0
func (v *TagBuilder) DB(db ...string) *TagBuilder
func (*TagBuilder) DDL ¶ added in v0.72.0
func (v *TagBuilder) DDL(ddl ...string) *TagBuilder
func (*TagBuilder) Identifier ¶ added in v0.72.0
func (v *TagBuilder) Identifier() *TagBuilder
func (*TagBuilder) Keyword ¶ added in v0.72.0
func (v *TagBuilder) Keyword() *TagBuilder
func (*TagBuilder) List ¶ added in v0.72.0
func (v *TagBuilder) List() *TagBuilder
func (*TagBuilder) NoEquals ¶ added in v0.73.0
func (v *TagBuilder) NoEquals() *TagBuilder
func (*TagBuilder) NoParentheses ¶ added in v0.72.0
func (v *TagBuilder) NoParentheses() *TagBuilder
func (*TagBuilder) Parameter ¶ added in v0.72.0
func (v *TagBuilder) Parameter() *TagBuilder
func (*TagBuilder) Parentheses ¶ added in v0.73.0
func (v *TagBuilder) Parentheses() *TagBuilder
func (*TagBuilder) SQL ¶ added in v0.72.0
func (v *TagBuilder) SQL(sql ...string) *TagBuilder
func (*TagBuilder) SingleQuotes ¶ added in v0.73.0
func (v *TagBuilder) SingleQuotes() *TagBuilder
func (*TagBuilder) Static ¶ added in v0.72.0
func (v *TagBuilder) Static() *TagBuilder
type Validation ¶
type Validation struct { Type ValidationType FieldNames []string }
func NewValidation ¶
func NewValidation(validationType ValidationType, fieldNames ...string) *Validation
func (*Validation) Condition ¶
func (v *Validation) Condition(field *Field) string
func (*Validation) ReturnedError ¶ added in v0.72.0
func (v *Validation) ReturnedError(field *Field) string
func (*Validation) TodoComment ¶
func (v *Validation) TodoComment(field *Field) string
type ValidationType ¶
type ValidationType int64
ValidationType contains all handled validation types. Below validations are marked to be contained here or not: - opts not nil - not present here, handled on template level - valid identifier - present here, for now put on level containing given field - conflicting fields - present here, put on level containing given fields - exactly one value set - present here, put on level containing given fields - at least one value set - present here, put on level containing given fields - validate nested field - present here, used for common structs which have their own validate() methods specified - nested validation conditionally - not present here, handled by putting validations on lower level fields
const ( ValidIdentifier ValidationType = iota ValidIdentifierIfSet ConflictingFields ExactlyOneValueSet AtLeastOneValueSet ValidateValue ValidateValueSet )