Documentation ¶
Index ¶
- func GetAndSetID(req *http.Request, s *scope.Scope) (prim interface{}, err error)
- func GetID(query *url.URL, mStruct *models.ModelStruct) (id string, err error)
- type JSONAPI
- func (b *JSONAPI) BuildRawFilter(s *scope.Scope, raw string, values ...interface{}) (fField *filters.FilterField, err error)
- func (b *JSONAPI) BuildScopeMany(ctx context.Context, model interface{}, query *url.URL, ...) (s *scope.Scope, errs []*aerrors.ApiError, err error)
- func (b *JSONAPI) BuildScopeRelated(ctx context.Context, model interface{}, query *url.URL, ...) (s *scope.Scope, errs []*aerrors.ApiError, err error)
- func (b *JSONAPI) BuildScopeRelationship(ctx context.Context, model interface{}, query *url.URL, ...) (s *scope.Scope, errs []*aerrors.ApiError, err error)
- func (b *JSONAPI) BuildScopeSingle(ctx context.Context, model interface{}, query *url.URL, id interface{}, ...) (s *scope.Scope, errs []*aerrors.ApiError, err error)
- func (b *JSONAPI) NewRootScope(mStruct *models.ModelStruct) *scope.Scope
- func (b *JSONAPI) NewScope(model interface{}) (*scope.Scope, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAndSetID ¶
GetAndSetID gets the id from the provided request and sets the primary field value to the id If the scope's value is not zero the function returns an error
Types ¶
type JSONAPI ¶
type JSONAPI struct { // I18n defines current builder i18n support I18n *i18n.Support // Config is the configuration for the builder Config *config.Builder // contains filtered or unexported fields }
JSONAPI is a struct that is responsible for creating the query scopes
func NewJSONAPI ¶
func NewJSONAPI(c *controller.Controller, cfg *config.Builder, i18nSupport *i18n.Support) *JSONAPI
NewJSONAPI creates new query builder
func (*JSONAPI) BuildRawFilter ¶
func (b *JSONAPI) BuildRawFilter( s *scope.Scope, raw string, values ...interface{}, ) (fField *filters.FilterField, err error)
BuildRawFilter build the filter from the provided values, with provided string values
func (*JSONAPI) BuildScopeMany ¶
func (b *JSONAPI) BuildScopeMany( ctx context.Context, model interface{}, query *url.URL, flgs ...*flags.Container, ) (s *scope.Scope, errs []*aerrors.ApiError, err error)
BuildScopeMany builds the scope for many type
func (*JSONAPI) BuildScopeRelated ¶
func (b *JSONAPI) BuildScopeRelated( ctx context.Context, model interface{}, query *url.URL, flgs ...*flags.Container, ) (s *scope.Scope, errs []*aerrors.ApiError, err error)
BuildScopeRelated builds the Related scope
func (*JSONAPI) BuildScopeRelationship ¶
func (b *JSONAPI) BuildScopeRelationship( ctx context.Context, model interface{}, query *url.URL, flgs ...*flags.Container, ) (s *scope.Scope, errs []*aerrors.ApiError, err error)
BuildScopeRelationship builds the relationship kind scope
func (*JSONAPI) BuildScopeSingle ¶
func (b *JSONAPI) BuildScopeSingle( ctx context.Context, model interface{}, query *url.URL, id interface{}, flgs ...*flags.Container, ) (s *scope.Scope, errs []*aerrors.ApiError, err error)
BuildScopeSingle builds the scope for the single query with id
func (*JSONAPI) NewRootScope ¶
func (b *JSONAPI) NewRootScope(mStruct *models.ModelStruct) *scope.Scope
NewRootScope creates new root scope for the given model struct
Click to show internal directories.
Click to hide internal directories.