Documentation
¶
Index ¶
- func Big5ToUtf8(source []byte) ([]byte, error)
- func Big5ToUtf8Str(source string) (string, error)
- func ContainAllMulti[T comparable](source []T, targets []T) bool
- func ContainAnyoneMulti[T comparable](source []T, targets []T) bool
- func Contains[T comparable](source []T, target T) bool
- func CountTransDate(startTime, endTime time.Time) int
- func DaysIn(m time.Month, y int) int
- func EquarList[T comparable](a ...T) bool
- func EquarTargetList[T comparable](source, target []T) bool
- func FastSearchWithInt(target int, source []int) int
- func GenStrUUID(serviceNodeNum int64) string
- func GenerateToken(serverHash string, data map[string]interface{}, expTime time.Time) (string, error)
- func GenerateTokenByStruct(name string, expTime time.Duration, data interface{}, secretKey []byte) (string, error)
- func GetNumberInString(source string) []string
- func HexToByte(hexString string) ([]byte, error)
- func Index[T comparable](source []T, target T) int
- func IsTransDate(startTime, endTime time.Time) bool
- func Marshal(v interface{}) ([]byte, error)
- func MsgDecode(data []byte) (*dtomsg.Dto_Base, error)
- func MsgEncode(data *dtomsg.Dto_Base) ([]byte, error)
- func ParseJavaUnixSec(t time.Time) int64
- func ParseToken(serverHash string, tokenString string) (map[string]interface{}, error)
- func ParseTokenByStruct(tokenString string, data interface{}, secretKey []byte) (*dto.JwtStruct, error)
- func ParseUnixSec(t int64) time.Time
- func ReadFileToLineStr(filePath string) []string
- func RemoveFirst[T comparable](source []T, target T) []T
- func RemoveFirstArray[T comparable](source []T, targets []T) []T
- func RemoveIndex[T comparable](source []T, idx int) []T
- func RemoveIndexCount[T comparable](source []T, idx int) []T
- func RemoveIndexMulti[T comparable](source []T, idxs []int) []T
- func RemoveUnPrintUncode(source string) string
- func ServerTimeNow() time.Time
- func Shuffle[T int64](source []T) []T
- func ShufflePoint[T int64](source []T)
- func Sort[T int64](source []T, desc ...bool) []T
- func SortPoint[T int64 | float64](source []T, desc ...bool)
- func UnitStr() string
- func Unmarshal(data []byte, v interface{}) error
- func Utf8ToBig5(source []byte) ([]byte, error)
- func Utf8ToBig5Str(source string) (string, error)
- type ClockTime
- func (t *ClockTime) GetNowTime() time.Time
- func (t *ClockTime) GetTickCount() uint64
- func (t *ClockTime) GetTimer() time.Duration
- func (t *ClockTime) MarshalJSON() ([]byte, error)
- func (t *ClockTime) ResetTimer()
- func (t *ClockTime) SetNowTime(nowTime time.Time)
- func (t *ClockTime) Ticket(tickTime time.Duration)
- func (t *ClockTime) UnmarshalJSON(b []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Big5ToUtf8 ¶
func Big5ToUtf8Str ¶
func ContainAllMulti ¶
func ContainAllMulti[T comparable](source []T, targets []T) bool
檢查目標陣列是否全部物件存在來源陣列內 (排除重複計算ex: source:[2], target:[2,2], return: false)
@params []T 比對來源
@params []T 比對目標
@return bool 是否包含所有物件
func ContainAnyoneMulti ¶
func ContainAnyoneMulti[T comparable](source []T, targets []T) bool
檢查目標陣列是否有任一物件存在來源陣列內
@params []T 比對來源
@params []T 比對目標
@return bool 是否包含所有物件
func Contains ¶
func Contains[T comparable](source []T, target T) bool
檢查站列是否包含目標
@params []T 比對來源
@params T 比對目標
@return bool 是否包含物件
func CountTransDate ¶
計算天數, 只關注日期不會在意時間
@params time.Time 開始時間
@params time.Time 結束時間
@return int 天數
func EquarTargetList ¶
func EquarTargetList[T comparable](source, target []T) bool
兩陣列是否相等
@params []T 比對來源
@params []T 比對目標
@return bool 是否相等
func GenStrUUID ¶
func GenerateToken ¶
func GenerateTokenByStruct ¶
func GenerateTokenByStruct(name string, expTime time.Duration, data interface{}, secretKey []byte) (string, error)
GenerateToken 生成 JWT 的函式
func Index ¶
func Index[T comparable](source []T, target T) int
取得目標存在於來源陣列的索引值
@params []T 索引來源
@params T 索引目標
@return int 索引值
func ParseToken ¶
func ParseTokenByStruct ¶
func ParseTokenByStruct(tokenString string, data interface{}, secretKey []byte) (*dto.JwtStruct, error)
ParseJWT 驗證和解碼 JWT 的函式
func ReadFileToLineStr ¶
func RemoveFirst ¶
func RemoveFirst[T comparable](source []T, target T) []T
刪除第一次出現的目標物件
@params []T 索引列表
@params T 目標物件
@return []T 複製結果
func RemoveFirstArray ¶
func RemoveFirstArray[T comparable](source []T, targets []T) []T
刪除所有目標第一次出現的物件
@params []T 索引列表
@params T 目標物件
@return []T 複製結果
func RemoveIndex ¶
func RemoveIndex[T comparable](source []T, idx int) []T
刪除索引直來源 0~n
@params source 索引列表 @params int 索引直範圍 0~n
func RemoveIndexCount ¶
func RemoveIndexCount[T comparable](source []T, idx int) []T
刪除索引直來源 1~n
@params source 索引列表 @params int 索引直範圍 1~n
func RemoveIndexMulti ¶
func RemoveIndexMulti[T comparable](source []T, idxs []int) []T
刪除索引直來源 1~n
@params source 索引列表 @params []int 索引直範圍 0~n
func ShufflePoint ¶
func ShufflePoint[T int64](source []T)
func Utf8ToBig5 ¶
func Utf8ToBig5Str ¶
Types ¶
type ClockTime ¶
type ClockTime struct {
// contains filtered or unexported fields
}