pkg

package
v0.0.0-...-e998ef4 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AccessTokenCookieName  string = "access_token"        // AccessToken Cookie名称
	RefreshTokenCookieName string = "refresh_token"       // RefreshToken Cookie名称
	TokenCookieMaxAge      int    = 60 * 60 * 24 * 7 * 52 // Cookie最大有效时间(秒)
	TokenCookiePath        string = "/"                   // Cookie路径
	TokenCookieDomain      string = ""                    // Cookie域名
	TokenCookieSecure      bool   = false                 // Cookie是否只在https时传递
	TokenCookieHttpOnly    bool   = true                  // Cookie是否限制js访问

	AccessTokenDuration  time.Duration = time.Second * 60 * 60 * 24     // AccessToken有效期
	RefreshTokenDuration time.Duration = time.Second * 60 * 60 * 24 * 7 // RefreshToken有效期
)
View Source
const (
	DefaultPageSize = 50  // 默认分页大小
	MaxPageSize     = 200 // 最大分页
)
View Source
const (
	ServiceDiscoveryAddress string = "127.0.0.1:8500" // 服务发现地址
)

Variables

This section is empty.

Functions

func BindAndValid

func BindAndValid(c *gin.Context, v interface{}) error

func GetPage

func GetPage(c *gin.Context) int

func GetPageOffset

func GetPageOffset(page, pageSize int) int

func GetPageSize

func GetPageSize(c *gin.Context) int

Types

type Alerter

type Alerter interface {
	Send(msg string)
}

type DingtalkAlert

type DingtalkAlert struct {
}

DingtalkAlert 钉钉通知

func NewDingtalkAlert

func NewDingtalkAlert() *DingtalkAlert

func (*DingtalkAlert) Send

func (alert *DingtalkAlert) Send(msg string)

type EmailAlert

type EmailAlert struct {
}

EmailAlert 邮件通知

func NewEmailAlert

func NewEmailAlert() *EmailAlert

func (*EmailAlert) Send

func (alert *EmailAlert) Send(msg string)

type Pager

type Pager struct {
	// 页码
	Page int `json:"page"`
	// 每页数量
	PageSize int `json:"page_size"`
	// 总行数
	TotalRows int `json:"total_rows"`
}

type Response

type Response struct {
	Ctx *gin.Context
}

func NewResponse

func NewResponse(ctx *gin.Context) *Response

func (*Response) ToErrorResponse

func (r *Response) ToErrorResponse(err error)

func (*Response) ToResponse

func (r *Response) ToResponse(data interface{})

func (*Response) ToResponseList

func (r *Response) ToResponseList(list interface{}, totalRows int)

type ValidError

type ValidError struct {
	Key     string `json:"key"`
	Message string `json:"message"`
}

func (*ValidError) Error

func (e *ValidError) Error() string

type ValidErrors

type ValidErrors []*ValidError

func (ValidErrors) Error

func (es ValidErrors) Error() string

func (ValidErrors) Errors

func (es ValidErrors) Errors() []string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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