util

package
v0.3.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Convert2Float32

func Convert2Float32(str string, dv float32) float32

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) string

func FormatV0 added in v0.3.1

func FormatV0(t *time.Time) 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

func TryParse added in v0.3.1

func TryParse(tStr string) time.Time

Types

type Numeric

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

Jump to

Keyboard shortcuts

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