Documentation
¶
Index ¶
- func NewFuncMap() template.FuncMap
- func ParseTemplater(tmpl Templater) (*template.Template, error)
- type Column
- func (c *Column) CanHavePreds() bool
- func (c *Column) FieldName() string
- func (c *Column) Identifier() string
- func (c *Column) IdentifierPlural() string
- func (c *Column) IsArray() bool
- func (c *Column) IsAuto() bool
- func (c *Column) IsComparable() bool
- func (c *Column) IsNillable() bool
- func (c *Column) IsOptional() bool
- func (c *Column) IsValueScanner() bool
- func (c *Column) Name() string
- func (c *Column) TypeInfo() *mira.TypeInfo
- type ColumnBuilder
- type ErrRequiredField
- type Logger
- type PostgresTemplate
- type SQLRunner
- type Schema
- func (s *Schema) Collection() string
- func (s *Schema) Columns() []*Column
- func (s *Schema) Identity() *Column
- func (s *Schema) Imports() []string
- func (s *Schema) PkgName() string
- func (s *Schema) Templaters() []Templater
- func (s *Schema) TypeIdentifier() string
- func (s *Schema) TypeIdentifierPlural() string
- func (s *Schema) TypeInfo() *mira.TypeInfo
- func (s *Schema) TypeName() string
- func (s *Schema) TypeNamePlural() string
- type SchemaBuilder
- func (sb *SchemaBuilder) Build() *Schema
- func (sb *SchemaBuilder) Collection(collection string) *SchemaBuilder
- func (sb *SchemaBuilder) Columns(columns ...*Column) *SchemaBuilder
- func (sb *SchemaBuilder) Identity(column *Column) *SchemaBuilder
- func (sb *SchemaBuilder) PkgName(pkgName string) *SchemaBuilder
- func (sb *SchemaBuilder) Templates(templaters ...Templater) *SchemaBuilder
- type Templater
- type Tx
- type ValueScanner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFuncMap ¶ added in v0.2.0
NewFuncMap returns a tempalte func map
Types ¶
type Column ¶
type Column struct {
// contains filtered or unexported fields
}
Column is a column
func (*Column) CanHavePreds ¶ added in v0.2.0
CanHavePreds returns true if column can have predicate functions
func (*Column) Identifier ¶ added in v0.2.0
Identifier returns the lower-camelized field name
func (*Column) IdentifierPlural ¶ added in v0.2.0
IdentifierPlural returns the plural form of lower-camelized field name
func (*Column) IsComparable ¶ added in v0.2.0
IsComparable returns the column comparable flag
func (*Column) IsNillable ¶ added in v0.2.0
IsNillable returns true if the column is nillable
func (*Column) IsOptional ¶ added in v0.2.0
IsOptional returns the optional flag
func (*Column) IsValueScanner ¶ added in v0.2.0
IsValueScanner returns true if column implements value scanner
type ColumnBuilder ¶ added in v0.2.0
type ColumnBuilder struct {
// contains filtered or unexported fields
}
ColumnBuilder is a column
func NewColumnBuilder ¶ added in v0.2.0
func NewColumnBuilder(name string, v interface{}) *ColumnBuilder
NewColumnBuilder returns a ColumnBuilder
func (*ColumnBuilder) Auto ¶ added in v0.2.0
func (cb *ColumnBuilder) Auto() *ColumnBuilder
Auto sets the column as auto-filled
func (*ColumnBuilder) Build ¶ added in v0.2.0
func (cb *ColumnBuilder) Build() *Column
Build builds the column
func (*ColumnBuilder) Comparable ¶ added in v0.2.0
func (cb *ColumnBuilder) Comparable() *ColumnBuilder
Comparable sets the column as comparable
func (*ColumnBuilder) Optional ¶ added in v0.2.0
func (cb *ColumnBuilder) Optional() *ColumnBuilder
Optional sets the column as optional
func (*ColumnBuilder) StructField ¶ added in v0.2.0
func (cb *ColumnBuilder) StructField(structField string) *ColumnBuilder
StructField sets the struct field name override. This is useful when the inferred struct field is different from the actual field e.g. The struct field of the model is "ID" but being referred to as "Id" in the generated code
type ErrRequiredField ¶ added in v0.2.0
type ErrRequiredField struct {
// contains filtered or unexported fields
}
ErrRequiredField is a required field error
func NewErrRequiredField ¶ added in v0.2.0
func NewErrRequiredField(field string) *ErrRequiredField
NewErrRequiredField returns an ErrFieldRequired error
func (*ErrRequiredField) Error ¶ added in v0.2.0
func (e *ErrRequiredField) Error() string
type PostgresTemplate ¶ added in v0.2.0
type PostgresTemplate struct {
// contains filtered or unexported fields
}
PostgresTemplate is the template for generating a postgres repository
func NewPostgresTemplate ¶ added in v0.2.0
func NewPostgresTemplate() *PostgresTemplate
NewPostgresTemplate returns a new PostgresTemplate
func (*PostgresTemplate) Filename ¶ added in v0.2.0
func (t *PostgresTemplate) Filename() string
Filename returns the filename
func (*PostgresTemplate) Template ¶ added in v0.2.0
func (t *PostgresTemplate) Template() string
Content returns the template content
func (*PostgresTemplate) WithFilename ¶ added in v0.2.0
func (t *PostgresTemplate) WithFilename(filename string) *PostgresTemplate
WithFilename overrides the default filename
type SQLRunner ¶
type SQLRunner interface {
Query(string, ...interface{}) (*sql.Rows, error)
QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
QueryRow(string, ...interface{}) *sql.Row
QueryRowContext(context.Context, string, ...interface{}) *sql.Row
Exec(string, ...interface{}) (sql.Result, error)
ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
}
SQLRunner is the standard sql interface runner
type Schema ¶
type Schema struct {
// contains filtered or unexported fields
}
Schema is a schema used for generating the repository
func (*Schema) Templaters ¶ added in v0.2.0
Templaters returns the templaters
func (*Schema) TypeIdentifier ¶ added in v0.2.0
TypeIdentifier returns the type identifier
func (*Schema) TypeIdentifierPlural ¶ added in v0.2.0
TypeIdentifierPlural returns the plural form of type identifier
func (*Schema) TypeNamePlural ¶ added in v0.2.0
type SchemaBuilder ¶ added in v0.2.0
type SchemaBuilder struct {
// contains filtered or unexported fields
}
SchemaBuilder is schema builder
func NewSchemaBuilder ¶ added in v0.2.0
func NewSchemaBuilder(v interface{}) *SchemaBuilder
NewSchemaBuilder takes a model struct value and returns a SchemaBuilder
func (*SchemaBuilder) Build ¶ added in v0.2.0
func (sb *SchemaBuilder) Build() *Schema
Build builds the schema
func (*SchemaBuilder) Collection ¶ added in v0.2.0
func (sb *SchemaBuilder) Collection(collection string) *SchemaBuilder
Collection sets the collection
func (*SchemaBuilder) Columns ¶ added in v0.2.0
func (sb *SchemaBuilder) Columns(columns ...*Column) *SchemaBuilder
Columns sets the columns
func (*SchemaBuilder) Identity ¶ added in v0.2.0
func (sb *SchemaBuilder) Identity(column *Column) *SchemaBuilder
Identity sets the identity column
func (*SchemaBuilder) PkgName ¶ added in v0.2.0
func (sb *SchemaBuilder) PkgName(pkgName string) *SchemaBuilder
PkgName sets the pkg name
func (*SchemaBuilder) Templates ¶ added in v0.2.0
func (sb *SchemaBuilder) Templates(templaters ...Templater) *SchemaBuilder
Templates sets the templates
type Templater ¶
type Templater interface {
// Filename is the filename of the generated file
Filename() string
// Template is template for generating the repository implementation
Template() string
}
Templater is an interface that wraps the Filename and Template method
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package aggregate contains types for implementing aggregate functions
|
Package aggregate contains types for implementing aggregate functions |
|
Package comparison contains types for comparison operations
|
Package comparison contains types for comparison operations |
|
Package example contains example types with schema definitions for demo and testing purposes.
|
Package example contains example types with schema definitions for demo and testing purposes. |
|
Package gen contains types and functions for code generation
|
Package gen contains types and functions for code generation |
|
Package sort contains types for implement sort/order functions
|
Package sort contains types for implement sort/order functions |
|
Package test contains tests
|
Package test contains tests |
|
gen
Package gen contains code generation tests
|
Package gen contains code generation tests |
|
integration
command
|
|
|
integration/playerrepo
Code generated by nero, DO NOT EDIT.
|
Code generated by nero, DO NOT EDIT. |
|
x
|
|