util

package
v0.0.0-...-9c8f64a Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllIsInvisibleCharacter

func AllIsInvisibleCharacter(str string) bool

AllIsInvisibleCharacter return true if str is full of space

func CheckContent

func CheckContent(str string) bool

CheckContent return ture if the content has

func CheckEmail

func CheckEmail(email string) bool

CheckEmail return ture if the email is valid or false if invalid

func CheckPassword

func CheckPassword(password string) bool

CheckPassword return ture if the password is valid or false if invalid

func CheckPhoneNumber

func CheckPhoneNumber(phoneNumber string) bool

CheckPhoneNumber return ture if the phoneNumber is valid or false if invalid

func CheckUsername

func CheckUsername(username string) bool

CheckUsername return ture if the username is valid or false if invalid

func CloseDB

func CloseDB()

CloseDB close the connection of db

func DB

func DB() *gorm.DB

DB return the pointer of db

func DeletePreAndSufSpace

func DeletePreAndSufSpace(str string) string

DeletePreAndSufSpace delete the space before and after str

func GetHTMLText

func GetHTMLText(html string) string

GetHTMLText ...

func GetRedis

func GetRedis() *redis.Client

GetRedis return the pointer of db

func IsBlank

func IsBlank(str string) bool

IsBlank return true if str has not validate character

func MarkdownToHTML

func MarkdownToHTML(markdownStr string) string

MarkdownToHTML ...

func MaxInt

func MaxInt(a int, b int) int

MaxInt return max(a,b)

func MaxInt64

func MaxInt64(a int64, b int64) int64

MaxInt64 return max(a,b)

func MinInt

func MinInt(a int, b int) int

MinInt return min(a,b)

func MinInt64

func MinInt64(a int64, b int64) int64

MinInt64 return min(a,b)

func NowTimestamp

func NowTimestamp() int64

NowTimestamp return timestamp of now

func OpenDB

func OpenDB(dsn string, config *gorm.Config, maxIdleConns, maxOpenConns int, models ...interface{}) (err error)

OpenDB create a connection of db

func OpenRedis

func OpenRedis(host string, port string, password string) error

OpenRedis create a connection of redis

func RandomAvatarURL

func RandomAvatarURL(str string) string

RandomAvatarURL return random profile photo url str to md5 thanks to https://robohash.org

func SubString

func SubString(str string, start int, end int) string

SubString ...

func Timestamp

func Timestamp(t time.Time) int64

Timestamp return timestamp of t

Types

This section is empty.

Jump to

Keyboard shortcuts

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