Documentation ¶
Index ¶
- func NewFuncMap() template.FuncMap
- func ParseTemplate(t Template) (*template.Template, error)
- type ErrRequiredField
- type Field
- func (f *Field) Identifier() string
- func (f *Field) IdentifierPlural() string
- func (f *Field) IsArray() bool
- func (f *Field) IsAuto() bool
- func (f *Field) IsComparable() bool
- func (f *Field) IsNillable() bool
- func (f *Field) IsOptional() bool
- func (f *Field) IsValueScanner() bool
- func (f *Field) Name() string
- func (f *Field) StructField() string
- func (f *Field) TypeInfo() *mira.TypeInfo
- type FieldBuilder
- type Logger
- type PostgresTemplate
- type SQLRunner
- type SQLiteTemplate
- type Schema
- func (s *Schema) Fields() []*Field
- func (s *Schema) Identity() *Field
- func (s *Schema) Imports() []string
- func (s *Schema) PkgName() string
- func (s *Schema) Table() string
- func (s *Schema) Templates() []Template
- 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) Fields(fields ...*Field) *SchemaBuilder
- func (sb *SchemaBuilder) Identity(field *Field) *SchemaBuilder
- func (sb *SchemaBuilder) PkgName(pkgName string) *SchemaBuilder
- func (sb *SchemaBuilder) Table(table string) *SchemaBuilder
- func (sb *SchemaBuilder) Templates(templates ...Template) *SchemaBuilder
- type Template
- type Tx
- type ValueScanner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ErrRequiredField ¶
type ErrRequiredField struct {
// contains filtered or unexported fields
}
ErrRequiredField is a required field error
func NewErrRequiredField ¶
func NewErrRequiredField(field string) *ErrRequiredField
NewErrRequiredField returns an ErrFieldRequired error
func (*ErrRequiredField) Error ¶
func (e *ErrRequiredField) Error() string
type Field ¶
type Field struct {
// contains filtered or unexported fields
}
Field is a field
func (*Field) Identifier ¶
Identifier returns the lower-camelized struct field
func (*Field) IdentifierPlural ¶
IdentifierPlural returns the plural form of identifier
func (*Field) IsComparable ¶
IsComparable returns true if field is comparable i.e. with comparisong operators
func (*Field) IsNillable ¶
IsNillable returns true if the field is nillable
func (*Field) IsValueScanner ¶
IsValueScanner returns true if field implements value scanner
func (*Field) StructField ¶
StructField returns the struct field
type FieldBuilder ¶
type FieldBuilder struct {
// contains filtered or unexported fields
}
FieldBuilder is a field builder
func NewFieldBuilder ¶
func NewFieldBuilder(name string, v interface{}) *FieldBuilder
NewFieldBuilder takes a field name and a value and returns a FieldBuilder
func (*FieldBuilder) Auto ¶
func (fb *FieldBuilder) Auto() *FieldBuilder
Auto sets the auto-populated flag
func (*FieldBuilder) Optional ¶
func (fb *FieldBuilder) Optional() *FieldBuilder
Optional sets the optional flag
func (*FieldBuilder) StructField ¶
func (fb *FieldBuilder) StructField(structField string) *FieldBuilder
StructField sets the struct field
type Logger ¶
type Logger interface {
Printf(string, ...interface{})
}
Logger is an interface that wraps the Printf method
type PostgresTemplate ¶
type PostgresTemplate struct {
// contains filtered or unexported fields
}
PostgresTemplate is the template for generating a postgres repository
func NewPostgresTemplate ¶
func NewPostgresTemplate() *PostgresTemplate
NewPostgresTemplate returns a new PostgresTemplate
func (*PostgresTemplate) Content ¶
func (t *PostgresTemplate) Content() string
Content returns the template content
func (*PostgresTemplate) Filename ¶
func (t *PostgresTemplate) Filename() string
Filename returns the filename
func (*PostgresTemplate) WithFilename ¶
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 an interface that wraps the standard sql methods
type SQLiteTemplate ¶
type SQLiteTemplate struct {
// contains filtered or unexported fields
}
SQLiteTemplate is a template for generating an sqlite repository
func NewSQLiteTemplate ¶
func NewSQLiteTemplate() *SQLiteTemplate
NewSQLiteTemplate returns a new SQLiteTemplate
func (*SQLiteTemplate) Content ¶
func (t *SQLiteTemplate) Content() string
Content returns the template content
func (*SQLiteTemplate) Filename ¶
func (t *SQLiteTemplate) Filename() string
Filename returns the filename
func (*SQLiteTemplate) WithFilename ¶
func (t *SQLiteTemplate) WithFilename(filename string) *SQLiteTemplate
WithFilename overrides the default filename
type Schema ¶
type Schema struct {
// contains filtered or unexported fields
}
Schema is a schema used for generating the repository
func (*Schema) TypeIdentifier ¶
TypeIdentifier returns the type identifier
func (*Schema) TypeIdentifierPlural ¶
TypeIdentifierPlural returns the plural form of type identifier
func (*Schema) TypeNamePlural ¶
TypeNamePlural returns the plural form of the type name
type SchemaBuilder ¶
type SchemaBuilder struct {
// contains filtered or unexported fields
}
SchemaBuilder is used for building a schema
func NewSchemaBuilder ¶
func NewSchemaBuilder(v interface{}) *SchemaBuilder
NewSchemaBuilder takes a struct value and returns a SchemaBuilder
func (*SchemaBuilder) Fields ¶
func (sb *SchemaBuilder) Fields(fields ...*Field) *SchemaBuilder
Fields sets the fields
func (*SchemaBuilder) Identity ¶
func (sb *SchemaBuilder) Identity(field *Field) *SchemaBuilder
Identity sets the identity field
func (*SchemaBuilder) PkgName ¶
func (sb *SchemaBuilder) PkgName(pkgName string) *SchemaBuilder
PkgName sets the package name
func (*SchemaBuilder) Table ¶
func (sb *SchemaBuilder) Table(table string) *SchemaBuilder
Table sets the database table/collection name
func (*SchemaBuilder) Templates ¶
func (sb *SchemaBuilder) Templates(templates ...Template) *SchemaBuilder
Templates sets the templates
type Template ¶
type Template interface { // Filename is the filename of the generated file Filename() string // Content is returns the template content Content() string }
Template is an interface that wraps the Filename and Content method
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
test
|
|
integration/playerrepo
Code generated by nero, DO NOT EDIT.
|
Code generated by nero, DO NOT EDIT. |
x
|
|