pkgs

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Blk Black text style
	Blk = "30"
	// Rd red text style
	Rd = "31"
	// Grn green text style
	Grn = "32"
	// Yel yellow text style
	Yel = "33"
	// Blu blue text style
	Blu = "34"
	// Mgn magenta text style
	Mgn = "35"
	// Cyn cyan text style
	Cyn = "36"
	// Wht white text style
	Wht = "37"
	// Gry grey text style
	Gry = "90"

	// BlkBg black background style
	BlkBg = "40"
	// RdBg red background style
	RdBg = "41"
	// GrnBg green background style
	GrnBg = "42"
	// YelBg yellow background style
	YelBg = "43"
	// BluBg blue background style
	BluBg = "44"
	// MgnBg magenta background style
	MgnBg = "45"
	// CynBg cyan background style
	CynBg = "46"
	// WhtBg white background style
	WhtBg = "47"

	// R reset emphasis style
	R = "0"
	// B bold emphasis style
	B = "1"
	// D dim emphasis style
	D = "2"
	// I italic emphasis style
	I = "3"
	// U underline emphasis style
	U = "4"
	// In inverse emphasis style
	In = "7"
	// H hidden emphasis style
	H = "8"
	// S strikeout emphasis style
	S = "9"
)

Color styles

Variables

This section is empty.

Functions

func Black

func Black(msg interface{}, styles ...string) string

func BlackBg

func BlackBg(msg interface{}, styles ...string) string

func Blue

func Blue(msg interface{}, styles ...string) string

func BlueBg

func BlueBg(msg interface{}, styles ...string) string

func Bold

func Bold(msg interface{}, styles ...string) string

func Cyan

func Cyan(msg interface{}, styles ...string) string

func CyanBg

func CyanBg(msg interface{}, styles ...string) string

func Dim

func Dim(msg interface{}, styles ...string) string

func Disable

func Disable()

func Enable

func Enable()

func GenUniversalId

func GenUniversalId() string

GenUniversalId 生成全局唯一 ID

func GetRemoteIP

func GetRemoteIP(c *gin.Context) string

GetRemoteIP 获取客户端ip

func Green

func Green(msg interface{}, styles ...string) string

func GreenBg

func GreenBg(msg interface{}, styles ...string) string

func Grey

func Grey(msg interface{}, styles ...string) string

func Hidden

func Hidden(msg interface{}, styles ...string) string

func IntsToString

func IntsToString(ints []int64) string

IntsToString 将整型数组转换为逗号分隔的字符串

func Inverse

func Inverse(msg interface{}, styles ...string) string

func IsFileGreaterThan

func IsFileGreaterThan(filePath string, size int64) (bool, error)

IsFileGreaterThan 判断文件是否大于多少MB

func IsNoRowFoundError

func IsNoRowFoundError(err error) bool

IsNoRowFoundError gorm 'record not found' 错误处理

func IsRedisNilError

func IsRedisNilError(err error) bool

IsNoRowFoundError redis 'record not found' 错误处理

func Italic

func Italic(msg interface{}, styles ...string) string

func Magenta

func Magenta(msg interface{}, styles ...string) string

func MagentaBg

func MagentaBg(msg interface{}, styles ...string) string

func Output

func Output() io.Writer

Output returns the output.

func Print

func Print(args ...interface{})

Print is analogous to `fmt.Print` with termial detection.

func Printf

func Printf(format string, args ...interface{})

Printf is analogous to `fmt.Printf` with termial detection.

func Println

func Println(args ...interface{})

Println is analogous to `fmt.Println` with termial detection.

func Red

func Red(msg interface{}, styles ...string) string

func RedBg

func RedBg(msg interface{}, styles ...string) string

func Reset

func Reset(msg interface{}, styles ...string) string

func SaveToFile

func SaveToFile(fileName string, data []byte) error

SaveToFile 保存字节数据到指定文件

func SetOutput

func SetOutput(w io.Writer)

SetOutput sets the output.

func Strikeout

func Strikeout(msg interface{}, styles ...string) string

func String2Time

func String2Time(data string) time.Time

String2Time 时间字符串转 time

func Time2String

func Time2String(data time.Time) string

Time2String 时间转字符串

func Underline

func Underline(msg interface{}, styles ...string) string

func White

func White(msg interface{}, styles ...string) string

func WhiteBg

func WhiteBg(msg interface{}, styles ...string) string

func Yellow

func Yellow(msg interface{}, styles ...string) string

func YellowBg

func YellowBg(msg interface{}, styles ...string) string

Types

type Color

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

func NewColor added in v0.0.3

func NewColor() (c *Color)

New creates a Color instance.

func (*Color) Black

func (c *Color) Black(msg interface{}, styles ...string) string

func (*Color) BlackBg

func (c *Color) BlackBg(msg interface{}, styles ...string) string

func (*Color) Blue

func (c *Color) Blue(msg interface{}, styles ...string) string

func (*Color) BlueBg

func (c *Color) BlueBg(msg interface{}, styles ...string) string

func (*Color) Bold

func (c *Color) Bold(msg interface{}, styles ...string) string

func (*Color) Cyan

func (c *Color) Cyan(msg interface{}, styles ...string) string

func (*Color) CyanBg

func (c *Color) CyanBg(msg interface{}, styles ...string) string

func (*Color) Dim

func (c *Color) Dim(msg interface{}, styles ...string) string

func (*Color) Disable

func (c *Color) Disable()

Disable disables the colors and styles.

func (*Color) Enable

func (c *Color) Enable()

Enable enables the colors and styles.

func (*Color) Green

func (c *Color) Green(msg interface{}, styles ...string) string

func (*Color) GreenBg

func (c *Color) GreenBg(msg interface{}, styles ...string) string

func (*Color) Grey

func (c *Color) Grey(msg interface{}, styles ...string) string

func (*Color) Hidden

func (c *Color) Hidden(msg interface{}, styles ...string) string

func (*Color) Inverse

func (c *Color) Inverse(msg interface{}, styles ...string) string

func (*Color) Italic

func (c *Color) Italic(msg interface{}, styles ...string) string

func (*Color) Magenta

func (c *Color) Magenta(msg interface{}, styles ...string) string

func (*Color) MagentaBg

func (c *Color) MagentaBg(msg interface{}, styles ...string) string

func (*Color) Output

func (c *Color) Output() io.Writer

Output returns the output.

func (*Color) Print

func (c *Color) Print(args ...interface{})

Print is analogous to `fmt.Print` with termial detection.

func (*Color) Printf

func (c *Color) Printf(format string, args ...interface{})

Printf is analogous to `fmt.Printf` with termial detection.

func (*Color) Println

func (c *Color) Println(args ...interface{})

Println is analogous to `fmt.Println` with termial detection.

func (*Color) Red

func (c *Color) Red(msg interface{}, styles ...string) string

func (*Color) RedBg

func (c *Color) RedBg(msg interface{}, styles ...string) string

func (*Color) Reset

func (c *Color) Reset(msg interface{}, styles ...string) string

func (*Color) SetOutput

func (c *Color) SetOutput(w io.Writer)

SetOutput sets the output.

func (*Color) Strikeout

func (c *Color) Strikeout(msg interface{}, styles ...string) string

func (*Color) Underline

func (c *Color) Underline(msg interface{}, styles ...string) string

func (*Color) White

func (c *Color) White(msg interface{}, styles ...string) string

func (*Color) WhiteBg

func (c *Color) WhiteBg(msg interface{}, styles ...string) string

func (*Color) Yellow

func (c *Color) Yellow(msg interface{}, styles ...string) string

func (*Color) YellowBg

func (c *Color) YellowBg(msg interface{}, styles ...string) string

type ReqQuery

type ReqQuery struct {
	Key    string `json:"key"`
	Offset int    `json:"offset"`
	Limit  int    `json:"limit"`
}

ReqQuery 列表查询参数

type ResultInfo

type ResultInfo struct {
	Code  string `json:"code" `
	Msg   string `json:"msg"`
	Total int64  `json:"total,omitempty"`
	Data  any    `json:"data"`
}

ResultInfo http响应消息结构体

Directories

Path Synopsis
storage

Jump to

Keyboard shortcuts

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