Version: v0.0.0-...-5a7003e Latest Latest

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

Go to latest
Published: Jul 12, 2019 License: LGPL-3.0 Imports: 23 Imported by: 0




View Source
const (
	SuccessCode = 200
	ErrorCode = 400
	AuthFailCode = 401
	ParamsErrorCode = 402
	PermissionDeniedCode = 403
	NullDataCode = 404
	ImgCodeNull = 500
	ImgCodeFailCode = 501
	ConfirmCode = 700
View Source
const (
	GetParsFailResult   = "获取参数失败"
	ParsFailResult      = "参数校验失败"
	GetDataNullResult   = "数据不存在"
	GetDataFailResult   = "获取数据失败"
	AddSuccessResult    = "添加成功"
	UpdateSuccessResult = "修改成功"
	DeleteSuccessResult = "删除成功"
	AddFailResult       = "添加失败"
	UpdateFailResult    = "修改失败"
	DeleteFailResult    = "删除失败"
	GetFailResult       = "获取失败"
View Source
const PageSize = 10


This section is empty.


func Alert

func Alert(c echo.Context, tip string) error

func AuthFail

func AuthFail(c echo.Context, msg string) error

func AuthFailNull

func AuthFailNull(c echo.Context) error

func AuthFailOrgNull

func AuthFailOrgNull(c echo.Context) error

func CheckEmail

func CheckEmail(value interface{}) bool


func CheckFloat64Range

func CheckFloat64Range(value interface{}, min, max float64) bool


func CheckIPv4

func CheckIPv4(value interface{}) bool


func CheckIntRange

func CheckIntRange(value interface{}, min, max int) bool


func CheckLen

func CheckLen(value interface{}, length int) bool

检查传入的值的长度,仅支持string、slice或者map 计算String的时候,以正则实现,中文字符算长度1

func CheckMobile

func CheckMobile(value interface{}) bool


func CheckRealNumber

func CheckRealNumber(value interface{}) bool


func CheckRegexp

func CheckRegexp(value interface{}, rex string) bool


func CheckType

func CheckType(value interface{}, expectType string) bool


func Confirm

func Confirm(c echo.Context, msg string, data interface{}) error

func ConfirmNUll

func ConfirmNUll(c echo.Context, msg string) error

func Contains

func Contains(strs []string, str string) bool

func ContainsInt64

func ContainsInt64(strs []int64, str int64) bool

func CreateFile

func CreateFile(path string) (*os.File, error)

func CurrentDate

func CurrentDate() string

func CurrentDateByPlace

func CurrentDateByPlace(place string) string

func CurrentDirectory

func CurrentDirectory() string


func CurrentTime

func CurrentTime() string

func Error

func Error(c echo.Context, msg string, data interface{}) error

func ErrorNull

func ErrorNull(c echo.Context, msg string) error

func FormatMonth

func FormatMonth(t time.Time) string

func FormatMonthChinese

func FormatMonthChinese(t time.Time) string

func FormatTime

func FormatTime(t time.Time) string

func GetFuncName

func GetFuncName() string

func GetPageIndex

func GetPageIndex(pi string) int

func GetPageNumber

func GetPageNumber(count, pageSize int) int

func GetPageSize

func GetPageSize(ps string) int

func GetRand

func GetRand() string


func ID

func ID() int64

func IDString

func IDString() string

func ImgCodeFail

func ImgCodeFail(c echo.Context) error

func ImgCodeNUll

func ImgCodeNUll(c echo.Context) error

func IsArray

func IsArray(value interface{}) bool


func IsDir

func IsDir(path string) bool


func IsFile

func IsFile(path string) bool


func IsMobile

func IsMobile(s string) bool

func IsUrl

func IsUrl(url string) bool

func IsValidBoolean

func IsValidBoolean(s string) bool

检查字符串是否代表一个合法的bool值 注意返回值仅表示是不是布尔值,并不表示布尔值本身的含义

func IsValidDate

func IsValidDate(s string) bool

func IsValidNumber

func IsValidNumber(s string) bool


func IsValidTime

func IsValidTime(s string) bool

func IsWechatBrowser

func IsWechatBrowser(userAgent string) bool

func JsonParentPath

func JsonParentPath(params ...string) string

func JsonPath

func JsonPath(params ...string) string

func MkdirAll

func MkdirAll(path string) error


func MobileReplaceRepl

func MobileReplaceRepl(str string) string

func NullData

func NullData(c echo.Context) error

func ParamsError

func ParamsError(c echo.Context, data interface{}) error

func ParseDate

func ParseDate(date string) (time.Time, error)

func ParseExcelDate

func ParseExcelDate(date string) (d *time.Time, err error)


func ParseTime

func ParseTime(date string) (time.Time, error)

func PathExists

func PathExists(path string) (bool, error)

func PermissionDenied

func PermissionDenied(c echo.Context) error

func Read

func Read(path string) string

func ReadByte

func ReadByte(path string) []byte

func Redirect

func Redirect(c echo.Context, url string) error

func RedirectAndAlert

func RedirectAndAlert(c echo.Context, tip, url string) error

func Result

func Result(c echo.Context, ret int64, msg string, data interface{}) error

func ResultApi

func ResultApi(c echo.Context, data interface{}) error

func ResultHtml

func ResultHtml(c echo.Context, html string) error

func ResultString

func ResultString(c echo.Context, str string) error

func Separator

func Separator() string


func SubStrByByte

func SubStrByByte(str string, length int) string

func SubStrByByteInChar

func SubStrByByteInChar(str string, length int) string

func Substr

func Substr(s string, pos, length int) string

func Success

func Success(c echo.Context, msg string, data interface{}) error

func SuccessNull

func SuccessNull(c echo.Context, msg string) error

func SuccessNullMsg

func SuccessNullMsg(c echo.Context, data interface{}) error

func SuccessRespone

func SuccessRespone(c echo.Context, data string) error

func Trim

func Trim(str string) string


func TrimHtml

func TrimHtml(src string) string


type Count

type Count struct {
	// contains filtered or unexported fields

type CustomBinder

type CustomBinder struct{}

func (*CustomBinder) Bind

func (b *CustomBinder) Bind(i interface{}, c echo.Context) (err error)

Bind implements the `Binder#Bind` function.

type PageData

type PageData struct {
	PageIndex  int         `json:"pageNo"`
	PageSize   int         `json:"pageSize"`
	PageNumber int         `json:"pageNum"`
	Count      int         `json:"totalCount"`
	Data       interface{} `json:"data"`

func QueryPage

func QueryPage(db *gorm.DB, page *PageTable, data interface{}, args ...interface{}) (*PageData, error)

func QueryPageMaps

func QueryPageMaps(db *gorm.DB, page *PageTable, args ...interface{}) (*PageData, error)

type PageTable

type PageTable struct {
	Fields    string
	Table     string
	Where     string
	PageIndex int
	PageSize  int
	Order     string
	GroupBy   string

type RandID

type RandID struct {
	// contains filtered or unexported fields

func NewRandID

func NewRandID() *RandID

func (*RandID) NextId

func (id *RandID) NextId() int64

type Random

type Random struct{}

Random random

func NewRandom

func NewRandom() *Random

NewRandom new random

func (Random) Number

func (rd Random) Number(length float64) int

Number random number

func (Random) NumberByInt

func (rd Random) NumberByInt(start, end int) int

func (Random) String

func (rd Random) String(length int) string

String random string

type ResultParam

type ResultParam struct {
	Ret  int64       `json:"ret"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data"`

func ToResultParam

func ToResultParam(b []byte) ResultParam


Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL