utils

package
v0.0.0-...-b5ce554 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Error

func Error(c constants.ErrorCode, msg string, gc ...codes.Code) error

Error ...

func GetOffsetLimit

func GetOffsetLimit(pagination *PaginationOptions) (offset, limit int64)

Types

type CustomError

type CustomError struct {
	Status       *status.Status
	Reason       string
	Metadata     map[string]string
	ErrorDetails []protoiface.MessageV1
}

CustomError ...

func NewError

func NewError(c constants.ErrorCode, msg string, gc ...codes.Code) *CustomError

NewError ...

func (*CustomError) AddErrorDetails

func (e *CustomError) AddErrorDetails(ed protoiface.MessageV1)

AddErrorDetails ...

func (*CustomError) AddMetadata

func (e *CustomError) AddMetadata(k string, v string)

AddMetadata ...

func (*CustomError) Err

func (e *CustomError) Err() error

Err ..

type CustomValidator

type CustomValidator struct {
	Validator *validator.Validate
	Trans     ut.Translator
}

CustomValidator ...

func NewCustomValidator

func NewCustomValidator() *CustomValidator

NewCustomValidator ...

func (*CustomValidator) Configure

func (cv *CustomValidator) Configure()

Configure ...

func (*CustomValidator) Validate

func (cv *CustomValidator) Validate(structRule interface{}) error

Validate ...

type Pagination

type Pagination struct {
	Items      interface{}
	Size       int64
	Total      int64
	TotalPages int64
}

func FormatPagination

func FormatPagination(items interface{}, size, total int64) *Pagination

type PaginationOptions

type PaginationOptions struct {
	Page        int64
	ItemPerPage int64
}

type Repository

type Repository interface {
	Create(ent interface{}) (err error)
	List(filters map[string]interface{}, order interface{}, out interface{}) (err error)
	Read(filters interface{}, ent interface{}) error
}

type Utils

type Utils struct{}

Utils ...

func NewUtils

func NewUtils() *Utils

NewUtils ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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