Documentation ¶
Index ¶
- type PG
- func (g *PG) Format() ([]byte, error)
- func (g *PG) Generate(w io.Writer, fns ...generator.Function) error
- func (g *PG) GenerateCreate()
- func (g *PG) GenerateDelete()
- func (g *PG) GenerateGet()
- func (g *PG) GenerateList()
- func (g *PG) GenerateType(t cruderType)
- func (g *PG) GenerateUpdate()
- func (g *PG) HeaderPrintf(in string, args ...interface{})
- func (g *PG) Printf(in string, args ...interface{})
- func (g *PG) SetPrimaryField(f string) error
- func (g *PG) SetReadFields(fields []string) error
- func (g *PG) SetSoftDeleteField(f string) error
- func (g *PG) SetWriteFields(fields []string) error
- func (g *PG) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PG ¶
type PG struct { TableName string PkgName string SkipSuffix bool // contains filtered or unexported fields }
PG generates the CRUD methods for Postgresql using lib/pg.
func (*PG) GenerateCreate ¶
func (g *PG) GenerateCreate()
GenerateCreate generates the Create method for the struct
func (*PG) GenerateDelete ¶
func (g *PG) GenerateDelete()
GenerateDelete generates the Delete method for the struct
func (*PG) GenerateGet ¶
func (g *PG) GenerateGet()
GenerateGet generates the Get method for the struct
func (*PG) GenerateList ¶
func (g *PG) GenerateList()
GenerateList generates the Get method for the struct
func (*PG) GenerateType ¶
func (g *PG) GenerateType(t cruderType)
GenerateType adds the cruderType to the header buffer. It keeps track of whether the type is generated or not and thus can be called multiple times safely.
func (*PG) GenerateUpdate ¶
func (g *PG) GenerateUpdate()
GenerateUpdate generates the Update method for the struct
func (*PG) HeaderPrintf ¶
HeaderPrintf writes the input to the PG's header buffer
func (*PG) SetPrimaryField ¶
SetPrimaryField sets the field that are used as primary key in lookups
func (*PG) SetReadFields ¶
SetReadFields sets the fields that should be returned in reading operations. The passed in slice will be match against the fieldnames of the struct
func (*PG) SetSoftDeleteField ¶
SetSoftDeleteField sets the field that should be used for soft deletion. The field should be of type nullable datetime but this function does not check that.
func (*PG) SetWriteFields ¶
SetWriteFields sets the fields that should be returned in writing operations. The passed in slice will be match against the fieldnames of the struct