util

package
v0.0.0-...-0b35b9a Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayPerm

func ArrayPerm(c *gin.Context, rol Rol) []string

func ArrayPermWithRol

func ArrayPermWithRol(c *gin.Context, rol Rol) []string

func CanPerm

func CanPerm() []string

func CloudantDefault

func CloudantDefault() *couchdb.Client

func CloudantOther

func CloudantOther(drive string) *couchdb.Client

func ComparePasswords

func ComparePasswords(hashedPwd string, plainPwd []byte) bool

func CurlBodyJSON

func CurlBodyJSON(method string, uri string, payload interface{}) string

func CurlGet

func CurlGet(uri string) string

func CurlPost

func CurlPost(payload interface{}, uri string) string

func FindDataAll

func FindDataAll(payload model.QuerySelectorAll) string

func FindDataIndex

func FindDataIndex(payload model.QuerySelectorPaginateIndex) string

func FindDataInterface

func FindDataInterface(payload interface{}) string

func FindDataPaginate

func FindDataPaginate(payload model.QuerySelectorPaginate) string

func GetIDsByRol

func GetIDsByRol(c *gin.Context, rol Rol) []model.RolesDev

func HashAndSalt

func HashAndSalt(pwd []byte) string

func IndexOf

func IndexOf(element string, data []string) int

func SetToken

func SetToken(claims CustomClaims) string

Types

type CustomClaims

type CustomClaims struct {
	// ID    uint
	ID    string
	Email string
	jwt.StandardClaims
}

type Module

type Module struct {
	Url          string   `json:"url"`
	IconWeb      string   `json:"iconWeb"`
	Mobile       string   `json:"mobile"`
	Android      string   `json:"android"`
	Ios          string   `json:"ios"`
	Ionic        string   `json:"ionic"`
	Name         string   `json:"name"`
	LangProperty string   `json:"lang_property"`
	Acl          string   `json:"acl"`
	Visible      bool     `json:"visible"`
	Value        []string `json:"value"`
}

func ArrayPermMenu

func ArrayPermMenu(c *gin.Context) []Module

type Paginate

type Paginate struct {
	Page  int `json:"page"`
	Limit int `json:"limit"`
}

type Response

type Response struct {
	Success bool        `json:"success"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}

func IsCreate

func IsCreate(c *gin.Context, rol Rol) Response

func IsDelete

func IsDelete(c *gin.Context, rol Rol) Response

func IsEdit

func IsEdit(c *gin.Context, rol Rol) Response

func IsRead

func IsRead(c *gin.Context, rol Rol) Response

func IsUpdate

func IsUpdate(c *gin.Context, rol Rol) Response

type ResponseJSON

type ResponseJSON struct {
	Data interface{} `json:"data"`
}

type ResponseProfile

type ResponseProfile struct {
	Success bool          `json:"success"`
	Message string        `json:"message"`
	Data    model.Profile `json:"data"`
}

type ResponseU

type ResponseU struct {
	Success bool       `json:"success"`
	Message string     `json:"message"`
	Data    model.User `json:"data"`
}

func DecodeHeaderToken

func DecodeHeaderToken(c *gin.Context) ResponseU

func DecodeToken

func DecodeToken(strToken string) ResponseU

type Rol

type Rol struct {
	Rol    string `json:"rol"`
	Module Module `json:"module"`
	Acl    string `json:"acl"`
}

type Roles

type Roles struct {
	Rol    string   `json:"rol"`
	Module []Module `json:"module"`
}

type RolesDev

type RolesDev struct {
	IDs    string   `json:"_id"`
	Rev    string   `json:"rev"`
	Rol    string   `json:"rol"`
	Module []Module `json:"module"`
}

type Token

type Token struct {
	Token string `json:"token"`
}

type TokenDecode

type TokenDecode struct {
	ID    string
	Email string
	jwt.StandardClaims
}

type User

type User struct {
	// ID       string `json:"id"`
	// Avatar   string `json:"avatar"`
	// Username string `json:"username"`
	// Email    string `json:"email"`
	IDs      string `json:"_id"`
	Rev      string `json:"_rev"`
	ID       string `json:"id"`
	Avatar   string `json:"avatar"`
	Username string `json:"username" validate:"required"`
	Email    string `json:"email" validate:"required"`
}

func Auth

func Auth(c *gin.Context) User

Jump to

Keyboard shortcuts

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