std

package
v0.0.48 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContentTypeDownload = `application/force-download` //文件下载

	ContentTypeDefault = `text/plain; charset=UTF-8`              //文本
	ContentTypeJSON    = `application/json; charset=UTF-8`        //json
	ContentTypeHTML    = `text/html; charset=UTF-8`               //HTML
	ContentTypeXJS     = `application/x-javascript;charset=UTF-8` //JavaScript
	ContentTypeJS      = `text/javascript; charset=utf-8`         //JavaScript
	ContentTypeCSS     = `text/css; charset=utf-8`                //CSS

	ContentTypeImageJPEG = `image/jpeg`   //jpeg图片
	ContentTypeImageJPG  = `image/jpeg`   //jpg图片
	ContentTypeImagePNG  = `image/png`    //png图片
	ContentTypeImageWEBP = `image/webp`   //webp图片
	ContentTypeImageGIF  = `image/gif`    //gif图片
	ContentTypeImageICON = `image/x-icon` //icon图标

	ContentTypeImageOctetStream = `application/octet-stream` //八位字节流
)

Variables

This section is empty.

Functions

func AddAreaCode added in v0.0.46

func AddAreaCode(countryCode string, phone string) string

AddAreaCode 给号码添加上+号和区号 如果记录中不存在该国家或地区代码,则不做任何修改。

func AutoAddAreaCode added in v0.0.40

func AutoAddAreaCode(areaCode string, phone string) string

AutoAddAreaCode 自动增加区号 如果返回空字符串,则表示不是合格的手机号

func AutoDelAreaCode added in v0.0.40

func AutoDelAreaCode(areaCode string, phone string) string

AutoDelAreaCode 自动移除区号

func BitAutoString added in v0.0.24

func BitAutoString(size int64) string

BitAutoString 将字节自动输出成合适的单位内容。

func FileName

func FileName(filename string) string

FileName 将文件名转为合法的文件名

func IsPhone added in v0.0.40

func IsPhone(s string) bool

IsPhone 判断是否是手机号码的组成

func NumberToChineseCapital added in v0.0.24

func NumberToChineseCapital(number int64) string

NumberToChineseCapital 数字转成中文大写数字

func PhoneKeepNumbersOnly added in v0.0.10

func PhoneKeepNumbersOnly(phone string) string

PhoneKeepNumbersOnly 只保留下数字

func RemoveAreaCode added in v0.0.46

func RemoveAreaCode(countryCode string, phone string) string

RemoveAreaCode 根据国家或地区代码,移除号码前面的+号、区号、前缀0 如果记录中不存在该国家或地区代码,则不做任何修改。

Types

type Countries added in v0.0.10

type Countries struct {
	Code     string `json:"code"`      //国家或地区代码,大写
	AreaCode string `json:"area_code"` //区号
	Name     string `json:"name"`      //名称
}

func GetAllCountriesInfo added in v0.0.46

func GetAllCountriesInfo() []Countries

GetAllCountriesInfo 获取全部国家或地区信息

func GetCountryInfo added in v0.0.10

func GetCountryInfo(countryCode string) (Countries, error)

GetCountryInfo 获取指定国家或地区的区号及名称-根据国家或地区代码

type ListParams added in v0.0.23

type ListParams struct {
	ID   uint `json:"id"`
	Page int  `json:"page" validate:"required,min=1"`
	Size int  `json:"size" validate:"required,min=1,max=10000"`
}

type Resp added in v0.0.23

type Resp struct {
	Code int      `json:"code"`
	Msg  string   `json:"msg"`
	Data RespData `json:"data"`
}

func NewResp added in v0.0.23

func NewResp(code int, msg string, data any, other any) Resp

func (Resp) String added in v0.0.23

func (r Resp) String() string

type RespData added in v0.0.23

type RespData struct {
	Data  any `json:"data"`
	Other any `json:"other"`
}

Jump to

Keyboard shortcuts

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