helpers

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFilters

func GetFilters(q url.Values, safeFields []string) (bson.D, error)

builds the filtering query based on user url request e.g. ?filter=id>='1'

func GetLinkHeaders

func GetLinkHeaders(totalCount int64, r *http.Request) string

returns the relevant link headers for a given query

func GetOption

func GetOption(q url.Values, safeFields []string) (*options.FindOneOptions, []error)

func GetOptions

func GetOptions(q url.Values, safeFields []string) (*options.FindOptions, []error)

builds the database query parameters based on user url request e.g. ?limit=1&fields=id

func IsInvalid

func IsInvalid(e error) bool

Types

type ErrorObject

type ErrorObject struct {
	StatusCode  int    `json:"-"`
	CodeMajor   string `json:"codeMajor"`
	Severity    string `json:"severity"`
	Description string `json:"description"`
	CodeMinor   string `json:"codeMinor"`
	IsInvalid   bool   `json:"-"`
}

func (*ErrorObject) Error

func (e *ErrorObject) Error() string

func (*ErrorObject) Invalid

func (e *ErrorObject) Invalid() bool

func (*ErrorObject) Populate

func (e *ErrorObject) Populate()

Jump to

Keyboard shortcuts

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