methods

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: MIT Imports: 16 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 CreateLogger added in v0.0.10

func CreateLogger(level string) *zap.Logger

Create tailored logger

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 Keycloak added in v0.0.12

type Keycloak struct {
	Logger       *zap.SugaredLogger
	Gocloak      *gocloak.GoCloak
	ClientId     string
	ClientSecret string
	Realm        string

	Permissions *[]gocloak.RequestingPartyPermission
	// contains filtered or unexported fields
}

Keycloak settings

func (*Keycloak) VerifyToken added in v0.0.12

func (auth *Keycloak) VerifyToken(next http.HandlerFunc) http.HandlerFunc

Validate access token. No detailed permissions

func (*Keycloak) VerifyTokenPermissions added in v0.0.12

func (auth *Keycloak) VerifyTokenPermissions(permissions string, next http.HandlerFunc) http.HandlerFunc

Validate access token. With detail permissions

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