modules

package
v0.0.0-...-791dfb5 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//NLOGMSG for message body
	NLOGMSG = "message"
	//NLOGERR for error info
	NLOGERR = "error"
	//NLOGQUERY for detailed query tracing
	NLOGQUERY = "query"
)

Variables

This section is empty.

Functions

func RandString

func RandString(n int) string

RandString random string alphanumeric. parameter length

func ReturnInvalidResponse

func ReturnInvalidResponse(httpcode int, details interface{}, message string) error

func SetPaginationFilter

func SetPaginationFilter(obj interface{}, c echo.Context)

func ValidateRequestPayload

func ValidateRequestPayload(c echo.Context, rules govalidator.MapData, data interface{}) (i interface{})

general function to validate all kind of api request payload / body

func ValidateRequestQuery

func ValidateRequestQuery(c echo.Context, rules govalidator.MapData) (i interface{})

general function to validate all kind of api request url query

Types

type JWTclaims

type JWTclaims struct {
	Username    string   `json:"username"`
	Group       string   `json:"group"`
	Permissions []string `json:"permissions"`
	jwt.StandardClaims
}

JWTclaims jwtclaims

type Pagination

type Pagination struct {
	*basemodel.BaseModel //must pointer
}

Pagination helper for short step init pagination filter

func (*Pagination) SetPaginationFilter

func (pc *Pagination) SetPaginationFilter(c echo.Context)

type ParseError

type ParseError struct {
	Info interface{}
}

ParseError custom errors detail

func (*ParseError) Error

func (e *ParseError) Error() string

Error must implement this Error func

type QueryFunc

type QueryFunc func(*gorm.DB, interface{}) error

QueryFunc user defined func must implement before call Exec

type QueryPaged

type QueryPaged struct {
	Result    basemodel.PagedFindResult
	TotalRows int
	Offset    int
	Rows      int
	Page      int
	LastPage  int
	Order     []string
	Sort      []string
	// contains filtered or unexported fields
}

QueryPaged custom query fields

func (*QueryPaged) Exec

func (mod *QueryPaged) Exec(db *gorm.DB, data interface{}, qFunc QueryFunc) error

Exec custom query

func (*QueryPaged) GenerateFilters

func (mod *QueryPaged) GenerateFilters(db *gorm.DB, filter interface{}, tableName string) (*gorm.DB, error)

GenerateFilters generate parameters filter

func (*QueryPaged) GetPage

func (mod *QueryPaged) GetPage(data interface{}) basemodel.PagedFindResult

GetPage result

func (*QueryPaged) Init

func (mod *QueryPaged) Init(c echo.Context) error

Init all atribute

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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