utils

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckStringCount

func CheckStringCount(str string, maxLen int) bool

CheckStringCount checks if the specified string length has been exceeded.

func ConvertToString

func ConvertToString(input interface{}) (string, error)

ConvertToString converts a basic type to a string type.

func GetBufferFromReadCloser

func GetBufferFromReadCloser(r io.ReadCloser) ([]byte, error)

GetBufferFromReadCloser gets buffer

func GetMySQLDsn

func GetMySQLDsn(username, password, server, port, db, parameter string) string

GetMySQLDsn creates a MySQL DSN string. about DSN document. https://github.com/go-sql-driver/mysql#dsn-data-source-name

func GetPostgresDsn

func GetPostgresDsn(user, password, host, port, dbname, parameter string) string

GetPostgresDsn creates a Postgres DSN string.

func GetStringCount

func GetStringCount(str string) int

GetStringCount gets the number of characters in a person's view.

func GetStringFromReadCloser

func GetStringFromReadCloser(r io.ReadCloser) (string, error)

GetStringFromReadCloser gets string

func SliceUTF8

func SliceUTF8(str string, pos int) string

SliceUTF8 gets the characters from the beginning to the specified position, in UTF-8-based characters.

func SliceUTF8AddString

func SliceUTF8AddString(str string, pos int, addString string) string

SliceUTF8AddString gets the characters from the beginning to the specified position, in UTF-8-based characters.

func TransactionGorm

func TransactionGorm(db *gorm.DB, f func(db *gorm.DB) error) error

TransactionGorm automatically performs transactions (Begin/Commit/Rollback) between specified func...

Types

This section is empty.

Jump to

Keyboard shortcuts

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