public

package module
v0.0.0-...-23f538b Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2022 License: Apache-2.0 Imports: 24 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB

Functions

func GetCaptcha

func GetCaptcha(id, typ string) (idKey string, value string, instance base64Captcha.CaptchaInterface)

func GetCaptchaBase64

func GetCaptchaBase64(id, typ string) (string, string)

GetCaptchaBase64: 获取图片验证码 以base64字符串返回

func NewTracer

func NewTracer(serviceName string) (opentracing.Tracer, io.Closer, error)

NewTracer: 创建链路追踪实例

func ResponseAny

func ResponseAny(c *gin.Context, err interface{}, any interface{})

ResponseAny : do response

func ResponseError

func ResponseError(c *gin.Context, err *BusinessException)

func ResponseSuccess

func ResponseSuccess(c *gin.Context, data interface{})

func SendEmail

func SendEmail(receiver string)

func SendHTMLEmail

func SendHTMLEmail(receiver string, path string, variables interface{}) error

SendHTMLEmail: 发送HTML格式邮件

Types

type BusinessException

type BusinessException struct {
	// contains filtered or unexported fields
}

func BadRequestException

func BadRequestException(desc string) *BusinessException

BadRequestException: 错误的客户端请求,自定义错误信息

func EntityExistException

func EntityExistException(entity, property string, value interface{}) *BusinessException

EntityExistException: 存在属性相同的实体

func IntervalException

func IntervalException(desc string) *BusinessException

IntervalException: 服务器内部错误,自定义错误信息

func NewBusinessException

func NewBusinessException(enum ExceptionEnum) *BusinessException

func NoException

func NoException(desc string) *BusinessException

func SendEmailCode

func SendEmailCode(duration time.Duration, email, redisKey, templatePath string) *BusinessException

SendEmailCode: 发送邮箱验证码

func VerifyCaptcha

func VerifyCaptcha(id, value string) *BusinessException

VerifyCaptcha : 校验验证码

func (BusinessException) Code

func (c BusinessException) Code() int32

func (BusinessException) Error

func (c BusinessException) Error() string

type EmailConfig

type EmailConfig struct {
	Id   int
	Host string
	Port string
	User string
	Pass string
}

type ExceptionEnum

type ExceptionEnum int32
const (
	//not business exception : dao,valid,etc.
	VALID_PARM_ERROR        ExceptionEnum = 10000
	PREPARE_SQL_ERROR       ExceptionEnum = 10001
	EXECUTE_SQL_ERROR       ExceptionEnum = 10002
	ROW_SCAN_ERROR          ExceptionEnum = 10003
	BEGIN_TRANSACTION_ERROR ExceptionEnum = 10004

	OK                       ExceptionEnum = 20000
	MEMBER_NOT_EXIST         ExceptionEnum = 20001
	USER_LOGIN_NAME_EXIST    ExceptionEnum = 20002
	USER_NOT_EXIST           ExceptionEnum = 20003
	LOGIN_MEMBER_ERROR       ExceptionEnum = 20004
	VERIFY_CODE_TOO_FREQUENT ExceptionEnum = 20005
	VERIFY_CODE_ERROR        ExceptionEnum = 20006
	VERIFY_CODE_EXPIRED      ExceptionEnum = 20007
	ERROR_PASSWORD           ExceptionEnum = 20008
	SAME_PASSWORD            ExceptionEnum = 20009
	SEND_EMAIL_CODE_ERROR    ExceptionEnum = 20010
	USER_EMAIL_EXIST         ExceptionEnum = 20011
	USER_PHONE_EXIST         ExceptionEnum = 20012
	ROLE_USER_EXIST          ExceptionEnum = 20013

	BAD_REQUEST    ExceptionEnum = 40000
	INTERVAL_ERROR ExceptionEnum = 50000
)

type HashSet

type HashSet struct {
	// contains filtered or unexported fields
}

HashSet holds elements in go's native map

func NewHashSet

func NewHashSet(values ...interface{}) *HashSet

NewHashSet instantiates a new empty set and adds the passed values, if any, to the set

func (*HashSet) Add

func (set *HashSet) Add(items ...interface{})

Add adds the items (one or more) to the set.

func (*HashSet) Clear

func (set *HashSet) Clear()

Clear clears all values in the set.

func (*HashSet) Contains

func (set *HashSet) Contains(items ...interface{}) bool

Contains check if items (one or more) are present in the set. All items have to be present in the set for the method to return true. Returns true if no arguments are passed at all, i.e. set is always superset of empty set.

func (*HashSet) Empty

func (set *HashSet) Empty() bool

Empty returns true if set does not contain any elements.

func (*HashSet) FromJSON

func (set *HashSet) FromJSON(data []byte) error

FromJSON populates the set from the input JSON representation.

func (*HashSet) Remove

func (set *HashSet) Remove(items ...interface{})

Remove removes the items (one or more) from the set.

func (*HashSet) Size

func (set *HashSet) Size() int

Size returns number of elements within the set.

func (*HashSet) String

func (set *HashSet) String() string

String returns a string representation of container

func (*HashSet) ToJSON

func (set *HashSet) ToJSON() ([]byte, error)

ToJSON outputs the JSON representation of the set.

func (*HashSet) Values

func (set *HashSet) Values() []interface{}

Values returns all items in the set.

type Response

type Response struct {
	Success bool        `json:"success"`
	Code    int32       `json:"code"`
	Message string      `json:"message"`
	Content interface{} `json:"content"`
}

Directories

Path Synopsis
middleware
proto

Jump to

Keyboard shortcuts

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