Documentation
¶
Index ¶
- func DeleteQuery(flavor Flavor, tableName string, id interface{}) (string, []interface{})
- func FindAllQuery(tableName string, options *FindAllOptions) (string, []interface{})
- func FindQuery(tableName string, options *FindOptions) (string, []interface{})
- func InsertQuery(flavor Flavor, tag, tableName string, structValue interface{}) (string, []interface{})
- func UpdateQuery(flavor Flavor, tag, tableName string, id interface{}, structValue interface{}) (string, []interface{})
- type FindAllOptions
- func (f *FindAllOptions) WithFields(fields []string) *FindAllOptions
- func (f *FindAllOptions) WithFilter(field string, value interface{}) *FindAllOptions
- func (f *FindAllOptions) WithForUpdate(mode string) *FindAllOptions
- func (f *FindAllOptions) WithLimit(limit int) *FindAllOptions
- func (f *FindAllOptions) WithOffset(offset int) *FindAllOptions
- func (f *FindAllOptions) WithOrderBy(orderBy string) *FindAllOptions
- type FindOptions
- type Flavor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteQuery ¶
DeleteQuery returns compiled DELETE string and args.
func FindAllQuery ¶
func FindAllQuery(tableName string, options *FindAllOptions) (string, []interface{})
FindAllQuery returns compiled SELECT string and args.
func FindQuery ¶
func FindQuery(tableName string, options *FindOptions) (string, []interface{})
FindQuery returns compiled SELECT string and args.
func InsertQuery ¶
func InsertQuery(flavor Flavor, tag, tableName string, structValue interface{}) (string, []interface{})
InsertQuery returns compiled INSERT string and args.
func UpdateQuery ¶
func UpdateQuery(flavor Flavor, tag, tableName string, id interface{}, structValue interface{}) (string, []interface{})
UpdateQuery returns compiled UPDATE string and args.
Types ¶
type FindAllOptions ¶
type FindAllOptions struct {
Flavor Flavor
Fields []string
Filters map[string]interface{}
Limit int
Offset int
OrderBy string
ForUpdate bool
ForUpdateMode string
}
FindAllOptions provides configuration for FindAllQuery function.
func NewFindAllOptions ¶
func NewFindAllOptions(flavor Flavor) *FindAllOptions
NewFindAllOptions returns a FindAllOptions.
func (*FindAllOptions) WithFields ¶
func (f *FindAllOptions) WithFields(fields []string) *FindAllOptions
WithFields is a helper function to construct functional options that sets Fields field.
func (*FindAllOptions) WithFilter ¶
func (f *FindAllOptions) WithFilter(field string, value interface{}) *FindAllOptions
WithFilter is a helper function to construct functional options that sets Filters field.
func (*FindAllOptions) WithForUpdate ¶ added in v1.1.0
func (f *FindAllOptions) WithForUpdate(mode string) *FindAllOptions
WithForUpdate is a helper function to construct functional options that sets ForUpdate and ForUpdateMode fields.
func (*FindAllOptions) WithLimit ¶
func (f *FindAllOptions) WithLimit(limit int) *FindAllOptions
WithLimit is a helper function to construct functional options that sets Limit field.
func (*FindAllOptions) WithOffset ¶
func (f *FindAllOptions) WithOffset(offset int) *FindAllOptions
WithOffset is a helper function to construct functional options that sets Offset field.
func (*FindAllOptions) WithOrderBy ¶
func (f *FindAllOptions) WithOrderBy(orderBy string) *FindAllOptions
WithOrderBy is a helper function to construct functional options that sets OrderBy field.
type FindOptions ¶
FindOptions provides configuration for FindQuery function.
func NewFindOptions ¶
func NewFindOptions(flavor Flavor) *FindOptions
NewFindOptions returns a FindOptions.
func (*FindOptions) WithFields ¶
func (f *FindOptions) WithFields(fields []string) *FindOptions
WithFields is a helper function to construct functional options that sets Fields field.
func (*FindOptions) WithFilter ¶
func (f *FindOptions) WithFilter(field string, value interface{}) *FindOptions
WithFilter is a helper function to construct functional options that sets Filters field.