base

package
v0.0.0-...-c9b56a8 Latest Latest
Warning

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

Go to latest
Published: May 9, 2021 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Overview

基础模块

Index

Constants

This section is empty.

Variables

View Source
var IsDev = !IsProd
View Source
var IsProd = strings.HasPrefix(strings.ToUpper(os.Getenv("APP_ENV")), "PROD")
View Source
var Validator = validator.New()

Functions

func UserErrorf

func UserErrorf(err error, format string, args ...interface{}) error

创建一个用户操作导致的错误,将该错误返回给前端,前端会显示一个弹窗

Types

type ID

type ID int64

func GenerateID

func GenerateID() ID

GenerateID an unique int64 ID

func (ID) MarshalJSON

func (i ID) MarshalJSON() ([]byte, error)

type SnowflakeIdWorker

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

* 构造

type UserError

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

用户错误,将该错误返回给前端,前端会显示一个错误弹窗

func (*UserError) Cause

func (w *UserError) Cause() error

func (*UserError) Error

func (w *UserError) Error() string

func (*UserError) Message

func (w *UserError) Message() string

func (*UserError) Unwrap

func (w *UserError) Unwrap() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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