util

package
v0.3.8-gz Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2024 License: MIT Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BcryptCheck added in v0.3.3

func BcryptCheck(password, hash string) bool

BcryptCheck 对比明文密码和数据库的哈希值

func BcryptHash added in v0.3.3

func BcryptHash(password string) string

BcryptHash 使用 bcrypt 对密码进行加密

func Convert2Float32

func Convert2Float32(str string, dv float32) float32

func ConvertPrt2Ids added in v0.3.5

func ConvertPrt2Ids(str *string) []int64

func ConvertString2Ids added in v0.3.5

func ConvertString2Ids(str string) []int64

func DoSend added in v0.2.8

func DoSend(to []string, subject string, body string) error

DoSend @function: send @description: Email发送方法 @param: subject string, body string @return: error

func Format added in v0.3.1

func Format[T *time.Time | time.Time](t T, format ...string) string

Format 此时直接出入 nil 会报错

func Format1 deprecated added in v0.3.7

func Format1(t *time.Time) string

Deprecated: Format

func FormatV0 deprecated added in v0.3.1

func FormatV0(t *time.Time) string

Deprecated: Format

func FormatVal deprecated added in v0.3.7

func FormatVal(t time.Time) string

Deprecated: Format

func JonIds added in v0.3.5

func JonIds(ids []int64, sp string) string

func MD5V added in v0.3.3

func MD5V(str []byte, b ...byte) string

MD5V @function: MD5V @description: md5加密 @param: str []byte @return: string

func Marshal

func Marshal(val any) (map[string]map[string]any, error)

Marshal marshals the given val and returns the map that contains the fields. optional=another is not implemented, and it's hard to implement and not common used.

func MonitorErrorToEmail added in v0.2.8

func MonitorErrorToEmail(subject string, body string) error

MonitorErrorToEmail @function: MonitorErrorToEmail @description: 给email中间件错误发送邮件到指定邮箱 @param: subject string, body string @return: error

func MustParse added in v0.3.1

func MustParse(tStr string) time.Time

func Parse added in v0.3.1

func Parse(tStr string) (time.Time, error)

func ReadAsNestedMap

func ReadAsNestedMap[T Numeric](filePath string, separator rune, fn func(v string, dv T) T, dv T) (map[string]map[string]T, error)

ReadAsNestedMap 读取CSV文件并返回嵌套的Map

func ToPrt added in v0.2.4

func ToPrt[T any](i T) *T

func ToVl added in v0.2.4

func ToVl[T any](i *T) T

ToVl 返回指针i指向的值,如果i是nil,则返回T的零值。

func TryParse added in v0.3.1

func TryParse(tStr string) time.Time

Types

type JwtUser added in v0.3.4

type JwtUser struct {
	Id          *int64    `json:"id"`
	Uuid        uuid.UUID `json:"uuid"`
	Name        *string   `json:"name"`
	Email       *string   `json:"email"`
	AuthorityId *int      `json:"authorityId"`
}

type Numeric

type Numeric interface {
	int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64 | float32 | float64
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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