go18

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2023 License: GPL-3.0 Imports: 11 Imported by: 0

README

🌿go18

go18, Golang十八般武艺.

《水浒传》言说:史进每日求王教头点拨十八般武艺,一一从头指教。那十八般武艺?矛锤弓弩铳,鞭锏剑链挝,斧钺并戈戟,牌棒与枪杈。

conver.go

  • X2String 任意对象转换成字符串

encoding.go

  • GbkToUtf8 字符串编码gbk->utf-8
  • Utf8ToGbk 字符串编码utf-8->gbk

random.go

  • XRandomInt 生成指定长度的随机数字字符串
  • XRandomString 生成指定长度的随机字符串
  • XRandomIntRange 生成指定区间的整数随机数

slice.go

  • XIsInSlice 判断元素item是否在切片内

time.go

  • XMonthDayList 当前月份日期列表
  • XMonthDayCnt 当前月份天数
  • XOrderNoFromNow 基于当前时间的字符串,可作为订单号使用,格式:20060102150405000000000
  • XChinaMonth 中国月份,「一」~「十二」月
  • XChinaWeekday 中国星期几,周「一」~「日」或星期「一」~「日」
  • XWeekdayInt 日期的本周的第『n』天,1-7,每周的第一天为周一
  • XDayLast235959 返回天的最后时间23:59:59.999999999
  • XWeekFirst 周的第一天的时间
  • XWeekLast 周的最后一天的时间
  • XWeekLast235959 返回周的最后一天的时间23:59:59.999999999
  • XMonthFirst 月的第一天的时间
  • XMonthLast 月的最后一天的时间
  • XMonthLast235959 返回月的最后一天的时间23:59:59.999999999
  • XYearFirst 返回年的第一天的时间
  • XYearLast 返回年的最后一天的时间
  • XYearLast235959 返回年的最后一天的时间23:59:59.999999999
  • XZeroTime 0点时间

其它的基于时间戳生成可读唯一订单号等

aliyunoss

阿里云OSS存储相关

aliyunsms

阿里云SMS短信服务相关

comstring

discard

ebi

电银支付相关

  • UnifiedOrder 支付统一下单

    ParseNotify 解析支付异步通知的参数

  • QueryOrder 支付订单查询
  • RefundOrder 订单退款

    ParseRefuncNotify 解析退款异步通知的参数

TODO

  • 统一下单
    • WX_NATIVE
    • AL_NATIVE
    • WX_JSAPI
    • ...
  • 订单查询
  • 订单退款

tenxunloc

腾讯位置服务

getui

个推服务

Android/IOS App的消息通知推送

Documentation

Overview

Package go18, golang十八般武艺(shibabanwuyi-s10i).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GbkToUtf8

func GbkToUtf8(s []byte) ([]byte, error)

GbkToUtf8 字符串编码gbk->utf-8

func ParseDuration added in v1.0.1

func ParseDuration(d string) (time.Duration, error)

func Utf8ToGbk

func Utf8ToGbk(s []byte) ([]byte, error)

Utf8ToGbk 字符串编码utf-8->gbk

func X2String

func X2String(val interface{}) (str string)

X2String 任意对象转换成字符串

func XChinaMonth

func XChinaMonth(day time.Time) string

XChinaMonth 返回日期的『n月』

day 日期

func XChinaWeekday

func XChinaWeekday(prefix string, day time.Time) string

XChinaWeekday 返回日期的『周n』或『星期n』

每周的第一天为周一

prefix 前缀,周|星期

day 日期

func XDayLast235959

func XDayLast235959(t time.Time) time.Time

XDayLast235959 返回天的最后时间23:59:59.999999999

t 时间

func XIsInSlice

func XIsInSlice(item interface{}, parent interface{}) (isExist bool, err error)

XIsInSlice 判断元素item是否在切片内

item 元素

parent 切片对象

func XMonthDayCnt

func XMonthDayCnt(when time.Time) int

XMonthDayCnt 当前月份天数

when 时间

func XMonthDayList

func XMonthDayList(when time.Time) (dayList []string)

XMonthDayList 当前月份日期列表

when 时间

func XMonthFirst

func XMonthFirst(t time.Time) time.Time

XMonthFirst 返回月的第一天的时间

t 时间

func XMonthLast

func XMonthLast(t time.Time) time.Time

XMonthLast 返回月的最后一天的时间

t 时间

func XMonthLast235959

func XMonthLast235959(t time.Time) time.Time

XMonthLast235959 返回月的最后一天的时间23:59:59.999999999

t 时间

func XOrderNoFromNow

func XOrderNoFromNow() string

XOrderNoFromNow 基于当前时间的字符串,可作为订单号使用

格式 20060102150405000000000

func XRandomInt

func XRandomInt(length int) string

XRandomInt 生成指定长度的随机数字字符串

length 字符串长度

func XRandomIntRange

func XRandomIntRange(min, max int) int

XRandomIntRange 生成指定区间的整数随机数

min 最小值

max 最大值

func XRandomString

func XRandomString(length int) string

XRandomString 生成指定长度的随机字符串

length 字符串长度

func XWeekFirst

func XWeekFirst(t time.Time) time.Time

XWeekFirst 返回周的第一天的时间

t 时间

func XWeekLast

func XWeekLast(t time.Time) time.Time

XWeekLast 返回周的最后一天的时间

t 时间

func XWeekLast235959

func XWeekLast235959(t time.Time) time.Time

XWeekLast235959 返回周的最后一天的时间23:59:59.999999999

t 时间

func XWeekdayInt

func XWeekdayInt(t time.Time) int

XWeekdayInt 返回日期的本周的第『n』天,1-7

每周的第一天为周一

t 时间

func XYearFirst

func XYearFirst(t time.Time) time.Time

XYearFirst 返回年的第一天的时间

t 时间

func XYearLast

func XYearLast(t time.Time) time.Time

XYearLast 返回年的最后一天的时间

t 时间

func XYearLast235959

func XYearLast235959(t time.Time) time.Time

XYearLast235959 返回年的最后一天的时间23:59:59.999999999

t 时间

func XZeroTime

func XZeroTime(d time.Time) time.Time

XZeroTime 0点时间

t 时间

Types

This section is empty.

Directories

Path Synopsis
Package aliyunoss 阿里云OSS相关功能
Package aliyunoss 阿里云OSS相关功能
Package aliyunsms 阿里云SMS短信服务
Package aliyunsms 阿里云SMS短信服务
Package comstring ...
Package comstring ...

Jump to

Keyboard shortcuts

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