app

package
v0.0.0-...-748440e Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DBX *sqlx.DB
)
View Source
var RecoverError = func() {
	if r := recover(); r != nil {

		err, ok := r.(error)
		if !ok {
			err = fmt.Errorf("unknown error: %v", r)
		}
		log.Errorf("unknown error: %v", err)
	}
}

Functions

func Go

func Go(f func())

func SHA256EncodeToBase64

func SHA256EncodeToBase64(text string) string

Types

type ApiCollectionResult

type ApiCollectionResult struct {
	TotalCount int         `json:"total_count"`
	Result     interface{} `json:"result"`
}

type ApiPagiationResult

type ApiPagiationResult struct {
	Pagination Pagination  `json:"meta"`
	Data       interface{} `json:"data"`
}

type AppError

type AppError struct {
	ErrorCode string `json:"error_code" bson:"-"`
	Message   string `json:"message" bson:"message"`
}

func (AppError) Error

func (e AppError) Error() string

type Pagination

type Pagination struct {
	Page       int `json:"page"`
	PerPage    int `json:"per_page"`
	TotalCount int `json:"total_count"`
	TotalPage  int `json:"total_page"`
}

func GetPaginationFromContext

func GetPaginationFromContext(c *napnap.Context) Pagination

func (*Pagination) SetTotalCount

func (p *Pagination) SetTotalCount(total int)

func (*Pagination) Skip

func (p *Pagination) Skip() int

Jump to

Keyboard shortcuts

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