Documentation ¶
Index ¶
- func DeleteQuery(flavor Flavor, tableName string, id interface{}) (string, []interface{})
- func DeleteWithOptionsQuery(tableName string, options *DeleteOptions) (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{})
- func UpdateWithOptionsQuery(tableName string, options *UpdateOptions) (string, []interface{})
- type DeleteOptions
- 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
- type UpdateOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteQuery ¶
DeleteQuery returns compiled DELETE string and args.
func DeleteWithOptionsQuery ¶ added in v1.3.0
func DeleteWithOptionsQuery(tableName string, options *DeleteOptions) (string, []interface{})
DeleteWithOptionsQuery returns compiled DELETE string and args from DeleteOptions.
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.
func UpdateWithOptionsQuery ¶ added in v1.3.0
func UpdateWithOptionsQuery(tableName string, options *UpdateOptions) (string, []interface{})
UpdateWithOptionsQuery returns compiled UPDATE string and args from UpdateOptions.
Types ¶
type DeleteOptions ¶ added in v1.3.0
DeleteOptions provides configuration for DeleteWithOptionsQuery function.
func NewDeleteOptions ¶ added in v1.3.0
func NewDeleteOptions(flavor Flavor) *DeleteOptions
NewDeleteOptions returns a DeleteOptions.
func (*DeleteOptions) WithFilter ¶ added in v1.3.0
func (d *DeleteOptions) WithFilter(field string, value interface{}) *DeleteOptions
WithFilter is a helper function to construct functional options that sets Filters field.
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 ¶
type FindOptions struct { Flavor Flavor Fields []string Filters map[string]interface{} ForUpdate bool ForUpdateMode string }
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.
func (*FindOptions) WithForUpdate ¶ added in v1.4.0
func (f *FindOptions) WithForUpdate(mode string) *FindOptions
WithForUpdate is a helper function to construct functional options that sets ForUpdate and ForUpdateMode fields.
type UpdateOptions ¶ added in v1.3.0
type UpdateOptions struct { Flavor Flavor Assignments map[string]interface{} Filters map[string]interface{} }
UpdateOptions provides configuration for UpdateWithOptionsQuery function.
func NewUpdateOptions ¶ added in v1.3.0
func NewUpdateOptions(flavor Flavor) *UpdateOptions
NewUpdateOptions returns a UpdateOptions.
func (*UpdateOptions) WithAssignment ¶ added in v1.3.0
func (u *UpdateOptions) WithAssignment(field string, value interface{}) *UpdateOptions
WithAssignment is a helper function to construct functional options that sets assignments.
func (*UpdateOptions) WithFilter ¶ added in v1.3.0
func (u *UpdateOptions) WithFilter(field string, value interface{}) *UpdateOptions
WithFilter is a helper function to construct functional options that sets Filters field.