methods

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BasicAuth

func BasicAuth(next http.HandlerFunc) http.HandlerFunc

basicAuth - adding basic authentication to route

func RespondWithError

func RespondWithError(w http.ResponseWriter, code int, err error)

RespondWithError - creating JSON response with error

func RespondWithJSON

func RespondWithJSON(w http.ResponseWriter, code int, payload interface{})

RespondWithJSON - creating JSON response

func ToBSON_D

func ToBSON_D(fields string, values string) bson.D

func ToBSON_M

func ToBSON_M(fields string, values string) bson.M

func Validations

func Validations(fl validator.FieldLevel) bool

Validations implements validator.Func

Types

type Count

type Count struct {
	Total           int    `json:"total"`
	Page            int    `json:"page"`
	Limit           int    `json:"limit"`
	SelfPagingToken string `json:"selfpagingtoken"`
	PrevPagingToken string `json:"prevpagingtoken"`
	NextPagingToken string `json:"nextpagingtoken"`
}

Count - Model for Count

type Links struct {
	Self  string `json:"self"`
	First string `json:"first"`
	Prev  string `json:"prev"`
	Next  string `json:"next"`
	Last  string `json:"last"`
}

Links - Model for Links

func CreateLinks(r *http.Request, count Count) Links

CreateLinks - Creating links for return object

type MongoPaginate

type MongoPaginate struct {
	// contains filtered or unexported fields
}

func NewMongoPaginate

func NewMongoPaginate(page int, limit int) *MongoPaginate

func (*MongoPaginate) GetPaginatedOpts

func (mp *MongoPaginate) GetPaginatedOpts() *options.FindOptions

type ReturnObject

type ReturnObject struct {
	Records any
	Count   Count
	Links   Links
}

ReturnObject - Model for ReturnObject

Jump to

Keyboard shortcuts

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