Documentation ¶
Overview ¶
Package gotpl provides a Go template for xo.
Index ¶
- Constants
- Variables
- func Conflict(ctx context.Context) string
- func Context(ctx context.Context) string
- func Custom(ctx context.Context) string
- func Esc(ctx context.Context, esc string) bool
- func FieldTag(ctx context.Context) string
- func First(ctx context.Context) *bool
- func Imports(ctx context.Context) []string
- func Inject(ctx context.Context) string
- func InjectFile(ctx context.Context) string
- func Int32(ctx context.Context) string
- func KnownTypes(ctx context.Context) map[string]bool
- func Legacy(ctx context.Context) bool
- func NotFirst(ctx context.Context) bool
- func Pkg(ctx context.Context) string
- func Shorts(ctx context.Context) map[string]string
- func Tags(ctx context.Context) []string
- func Uint32(ctx context.Context) string
- type Enum
- type EnumValue
- type Field
- type ForeignKey
- type Index
- type PackageImport
- type Proc
- type Query
- type QueryParam
- type Table
Constants ¶
View Source
const ( FirstKey xo.ContextKey = "first" KnownTypesKey xo.ContextKey = "known-types" ShortsKey xo.ContextKey = "shorts" NotFirstKey xo.ContextKey = "not-first" Int32Key xo.ContextKey = "int32" Uint32Key xo.ContextKey = "uint32" PkgKey xo.ContextKey = "pkg" TagKey xo.ContextKey = "tag" ImportKey xo.ContextKey = "import" UUIDKey xo.ContextKey = "uuid" CustomKey xo.ContextKey = "custom" ConflictKey xo.ContextKey = "conflict" InitialismKey xo.ContextKey = "initialism" EscKey xo.ContextKey = "esc" FieldTagKey xo.ContextKey = "field-tag" ContextKey xo.ContextKey = "context" InjectKey xo.ContextKey = "inject" InjectFileKey xo.ContextKey = "inject-file" LegacyKey xo.ContextKey = "legacy" )
Context keys.
Variables ¶
View Source
var Files embed.FS
Files are the embedded Go templates.
Functions ¶
func InjectFile ¶
InjectFile returns inject-file from the context.
func KnownTypes ¶
KnownTYpes returns known-types from the context.
Types ¶
type Field ¶
type Field struct { GoName string SQLName string Type string Zero string IsPrimary bool IsSequence bool Comment string }
Field is a field template.
type ForeignKey ¶
type ForeignKey struct { GoName string SQLName string Table Table Fields []Field RefTable string RefFields []Field RefFunc string Comment string }
ForeignKey is a foreign key template.
type Index ¶
type Index struct { SQLName string Func string Table Table Fields []Field IsUnique bool IsPrimary bool Comment string }
Index is an index template.
type PackageImport ¶
PackageImport holds information about a Go package import.
func (PackageImport) String ¶
func (v PackageImport) String() string
String satisfies the fmt.Stringer interface.
type Proc ¶
type Proc struct { Type string GoName string OverloadedName string SQLName string Signature string Params []Field Returns []Field Void bool Overloaded bool Comment string }
Proc is a stored procedure template.
type Query ¶
type Query struct { Name string Query []string Comments []string Params []QueryParam One bool Flat bool Exec bool Interpolate bool Type Table Comment string }
Query is a custom query template.
type QueryParam ¶
QueryParam is a custom query parameter template.
Click to show internal directories.
Click to hide internal directories.