util

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2023 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountryCode2EmojiAndName

func CountryCode2EmojiAndName(code string) string

func DownloadIfNotExist

func DownloadIfNotExist(remoteUrl, localPath string) error

func FileExist

func FileExist(path string) bool

func FormatNullableTime

func FormatNullableTime(t sql.NullTime) string

func FormatTime

func FormatTime(t time.Time) string

func HttpDownload

func HttpDownload(remoteUrl, localPath string, timeout time.Duration) error

func IsSqliteDuplicateError

func IsSqliteDuplicateError(err error) bool

func LoadJson

func LoadJson[T any](filename string) (T, error)

func PageHelper

func PageHelper(page, pageSize int) (limit, offset int)

func PageNormalize

func PageNormalize(page, pageSize int) (int, int)

func RandString

func RandString(num int) string

func TotalPage

func TotalPage(totalRows, pageSize int) int

Types

type UserAgentData

type UserAgentData struct {
	OS         string
	Browser    string
	Device     string
	DeviceType string
}

func ParseUserAgent

func ParseUserAgent(s string) UserAgentData

Jump to

Keyboard shortcuts

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