api

package
v0.0.0-...-47ace37 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AscendingOrder  = "ascending"
	DescendingOrder = "descending"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Attributes

type Attributes struct {
	Attributes         []string `form:"attributes" json:"attributes,omitempty" validate:"dive,attrpath"`
	ExcludedAttributes []string `form:"excludedAttributes" json:"excludedAttributes,omitempty" validate:"dive,attrpath"`
}

Attributes represents ...

func (*Attributes) Explode

func (a *Attributes) Explode()

Explode splits the attributes content by comma.

Notice that this assumes that URNs containing comma/s CANNOT be used.

type Filter

type Filter string

type InternalServerError

type InternalServerError struct {
	Detail string
}

InternalServerError is a wrapper of a generic server error

func (*InternalServerError) Error

func (e *InternalServerError) Error() string

type InvalidFilterError

type InvalidFilterError struct {
	Filter string
	Detail string
}

InvalidFilterError is thrown when the specified filter syntax is invalid or the specified attribute and filter comparison is not supported

func (*InvalidFilterError) Error

func (e *InvalidFilterError) Error() string

type InvalidPathError

type InvalidPathError struct {
	Path   string
	Detail string
}

InvalidPathError is thrown when path attribute is invalid or malformed

func (*InvalidPathError) Error

func (e *InvalidPathError) Error() string

type MissingRequiredPropertyError

type MissingRequiredPropertyError struct {
	Path   string
	Detail string
}

MissingRequiredPropertyError is ...

func (*MissingRequiredPropertyError) Error

type MutabilityError

type MutabilityError struct {
	Path   string
	Detail string
}

MutabilityError is ...

func (*MutabilityError) Error

func (e *MutabilityError) Error() string

type NotFoundError

type NotFoundError struct {
	Subject string
}

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

type Pagination

type Pagination struct {
	StartIndex int `form:"startIndex" json:"startIndex,omitempty" default:"1" validate:"omitempty,gt=0"`
	Count      int `form:"count" json:"count,omitempty" mold:"min=0"`
}

type ResourceNotFoundError

type ResourceNotFoundError struct {
	Detail string
}

ResourceNotFoundError is a wrapper of a mongo.ResourceNotFoundError

func (*ResourceNotFoundError) Error

func (e *ResourceNotFoundError) Error() string
type Search struct {
	Attributes
	Filter `form:"filter" json:"filter,omitempty"` // (todo)> add validator
	Sorting
	Pagination
}

Search represents the set of parameters of a search query

func NewSearch

func NewSearch() *Search

NewSearch instantiates a Search instance with defaults

func (*Search) UnmarshalJSON

func (s *Search) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals an Attribute taking into account defaults

type Sorting

type Sorting struct {
	SortBy    string `form:"sortBy" json:"sortBy,omitempty"`
	SortOrder string `form:"sortOrder" json:"sortOrder,omitempty" default:"ascending" validate:"omitempty,eq=ascending|eq=descending"`
}

type UniquenessError

type UniquenessError struct {
	Path   string
	Detail string
}

UniquenessError is ...

func (*UniquenessError) Error

func (e *UniquenessError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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