payload

package
v0.0.0-...-e5836b3 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: GPL-3.0 Imports: 17 Imported by: 13

Documentation

Index

Constants

View Source
const (
	DEFAULT_PAGE      = 0
	DEFAULT_PAGE_SIZE = 20
	DEFAULT_PAGE_ALL  = false
)
View Source
const (
	SORT_ASC  SortOrder = "asc"
	SORT_DESC SortOrder = "desc"

	DEFAULT_SORT_FIELD = "updated_at"
	DEFAULT_SORT_DIR   = SORT_DESC
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter

type Filter struct {
	Filter string
	// contains filtered or unexported fields
}

func NewFilter

func NewFilter(ctx *gin.Context) *Filter

func (*Filter) Parse

func (f *Filter) Parse() error

type FilterOperation

type FilterOperation string
const (
	FILTER_EQ  FilterOperation = "eq"
	FILTER_NE  FilterOperation = "ne"
	FILTER_GT  FilterOperation = "gt"
	FILTER_GTE FilterOperation = "gte"
	FILTER_LT  FilterOperation = "lt"
	FILTER_LTE FilterOperation = "lte"
	FILTER_BT  FilterOperation = "bt"
	FILTER_SW  FilterOperation = "sw"
	FILTER_EW  FilterOperation = "ew"
	FILTER_CT  FilterOperation = "ct"
)

type Http

type Http struct {
	Engine  *gin.Engine
	Request *HttpRequest
	// contains filtered or unexported fields
}

func NewHttp

func NewHttp(conf *configuration.Config, engine *gin.Engine, permissionsDb *redisdb.RedisDB, sessionsDb *redisdb.RedisDB) *Http

func (*Http) Parse

func (h *Http) Parse(g *gin.Context) error

type HttpCookie

type HttpCookie struct {
	UserSession *SessionAuth
	Ttl         int
	// contains filtered or unexported fields
}

func NewHttpCookie

func NewHttpCookie(conf *configuration.ConfigCookie, ctx *gin.Context, permissionsDb *redisdb.RedisDB, sessionsDb *redisdb.RedisDB, method string, route string) *HttpCookie

func (*HttpCookie) Parse

func (c *HttpCookie) Parse() error

func (*HttpCookie) SetCookie

func (c *HttpCookie) SetCookie() error

func (*HttpCookie) SetEmptyCookie

func (c *HttpCookie) SetEmptyCookie()

type HttpQuery

type HttpQuery struct {
	Pagination *Pagination
	Sort       *Sort
	Filter     *Filter
	Related    bool
	// contains filtered or unexported fields
}

func NewHttpQuery

func NewHttpQuery(ctx *gin.Context) *HttpQuery

func (*HttpQuery) Parse

func (h *HttpQuery) Parse() error

type HttpRequest

type HttpRequest struct {
	Session *HttpSession
	Query   *HttpQuery
	ID      uint
	// contains filtered or unexported fields
}

func NewRequest

func NewRequest(conf *configuration.Config, ctx *gin.Context, permissionsDb *redisdb.RedisDB, sessionsDb *redisdb.RedisDB) *HttpRequest

func (*HttpRequest) Bind

func (h *HttpRequest) Bind(obj any) error

func (*HttpRequest) Parse

func (h *HttpRequest) Parse() error

type HttpSession

type HttpSession struct {
	Auth *HttpCookie
	// contains filtered or unexported fields
}

func NewHttpSession

func NewHttpSession(conf *configuration.Config, ctx *gin.Context, permissionsDb *redisdb.RedisDB, sessionsDb *redisdb.RedisDB, method string, route string) *HttpSession

func (*HttpSession) Parse

func (h *HttpSession) Parse() error

type Operation

type Operation uint8
const (
	SVC_OPERATION_CREATE Operation = iota
	SVC_OPERATION_UPDATE
	SVC_OPERATION_DELETE
)

type Pagination

type Pagination struct {
	Page     uint
	PageSize uint
	All      bool
	// contains filtered or unexported fields
}

func NewPagination

func NewPagination(ctx *gin.Context) *Pagination

func (*Pagination) Parse

func (p *Pagination) Parse() error

type Payload

type Payload struct {
	Config   *configuration.Config
	Services Services
	Http     *Http
	// contains filtered or unexported fields
}

func (*Payload) SetConfig

func (p *Payload) SetConfig(config *configuration.Config)

func (*Payload) SetDatabase

func (p *Payload) SetDatabase(db *database.Db) error

func (*Payload) SetHistoryDb

func (p *Payload) SetHistoryDb(db *redisdb.RedisDB) error

func (*Payload) SetHttp

func (p *Payload) SetHttp(engine *gin.Engine) error

func (*Payload) SetLogsDb

func (p *Payload) SetLogsDb(db *redisdb.RedisDB) error

func (*Payload) SetPermissionsDb

func (p *Payload) SetPermissionsDb(db *redisdb.RedisDB) error

func (*Payload) SetSessionsDb

func (p *Payload) SetSessionsDb(db *redisdb.RedisDB) error

func (*Payload) Start

func (p *Payload) Start() error

type Services

type Services struct {
	Db            *database.Db
	SessionsDb    *redisdb.RedisDB
	PermissionsDb *redisdb.RedisDB
	HistoryDb     *redisdb.RedisDB
	LogsDb        *redisdb.RedisDB
}

type SessionAuth

type SessionAuth struct {
	ID             uint
	UserID         uint
	OrganizationID uint
	Email          string
	Name           string
	Surname        string
	AvatarUrl      string
}

func EmptySession

func EmptySession() *SessionAuth

type Sort

type Sort struct {
	Field string
	Order string
	// contains filtered or unexported fields
}

func NewSort

func NewSort(ctx *gin.Context) *Sort

func (*Sort) Parse

func (s *Sort) Parse() error

type SortOrder

type SortOrder string

type Started

type Started struct {
	StartedDb            bool
	StartedSessionsDb    bool
	StartedPermissionsDb bool
	StartedHistoryDb     bool
	StartedLogsDb        bool
}

type TokenClaims

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

Jump to

Keyboard shortcuts

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