query

package
v0.0.0-...-c407d37 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const FetchOneReflectionMessage = "Data error encountered"

FetchOneReflectionMessage means Model should be pointer to struct

Variables

This section is empty.

Functions

func GetSQLQueryByName

func GetSQLQueryByName(fileName string) (string, error)

func NewQueryAssociation

func NewQueryAssociation(field string) services.QueryAssociation

NewQueryAssociation creates a new query association

func NewQueryAssociations

func NewQueryAssociations(associations []services.QueryAssociation) services.QueryAssociations

NewQueryAssociations returns new query associations

func NewQueryAssociationsPreload

func NewQueryAssociationsPreload(associations []services.QueryAssociation) services.QueryAssociations

NewQueryAssociationsPreload returns new query associations using preload

func NewQueryFilter

func NewQueryFilter(column string, comparator string, value interface{}) services.QueryFilter

NewQueryFilter is a builder for query filters to be used by handlers and talk to services that require query filters

func NewQueryOrder

func NewQueryOrder(column *string, sortOrder *bool) services.QueryOrder

NewQueryOrder is a builder for query ordering to be used by handlers and talk to services that require query ordering

Types

type Builder

type Builder struct {
}

Builder is a wrapper around pop with more flexible query patterns to MilMove

func NewQueryBuilder

func NewQueryBuilder() *Builder

NewQueryBuilder returns a new query builder implemented with pop constructor is for Dependency Injection frameworks requiring a function instead of struct

func (*Builder) Count

func (p *Builder) Count(appCtx appcontext.AppContext, model interface{}, filters []services.QueryFilter) (int, error)

Count returns a count from a filter

func (*Builder) CreateOne

func (p *Builder) CreateOne(appCtx appcontext.AppContext, model interface{}) (*validate.Errors, error)

CreateOne creates exactly one model

func (*Builder) DeleteOne

func (p *Builder) DeleteOne(appCtx appcontext.AppContext, model interface{}) error

DeleteOne updates exactly one model

func (*Builder) FetchCategoricalCountsFromOneModel

func (p *Builder) FetchCategoricalCountsFromOneModel(appCtx appcontext.AppContext, model interface{}, filters []services.QueryFilter, andFilters *[]services.QueryFilter) (map[interface{}]int, error)

FetchCategoricalCountsFromOneModel returns categorical counts from exactly one model

func (*Builder) FetchMany

func (p *Builder) FetchMany(appCtx appcontext.AppContext, model interface{}, filters []services.QueryFilter, associations services.QueryAssociations, pagination services.Pagination, ordering services.QueryOrder) error

FetchMany fetches multiple model records using pop's All method Will return error if model is not pointer to slice of structs

func (*Builder) FetchOne

func (p *Builder) FetchOne(appCtx appcontext.AppContext, model interface{}, filters []services.QueryFilter) error

FetchOne fetches a single model record using pop's First method Will return error if model is not pointer to struct

func (*Builder) QueryForAssociations

func (p *Builder) QueryForAssociations(appCtx appcontext.AppContext, model interface{}, associations services.QueryAssociations, filters []services.QueryFilter, pagination services.Pagination, ordering services.QueryOrder) error

QueryForAssociations builds a query for associations

func (*Builder) UpdateOne

func (p *Builder) UpdateOne(appCtx appcontext.AppContext, model interface{}, eTag *string) (*validate.Errors, error)

UpdateOne updates exactly one model

type StaleIdentifierError

type StaleIdentifierError struct {
	StaleIdentifier string
}

StaleIdentifierError is used when optimistic locking determines that the identifier refers to stale data

func (StaleIdentifierError) Error

func (e StaleIdentifierError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL