util

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InTransaction

func InTransaction(db *gorm.DB) bool

InTransaction is used check whether current db is in transaction

func IsDir

func IsDir(path string) bool

IsDir is used to judge whether the specific path is a valid directory

func IsFile

func IsFile(path string) bool

IsFile is used to judge whether the specific path is a valid file path

func IsRecordNotFound

func IsRecordNotFound(err error) bool

IsRecordNotFound is used to determine that some error is RecordNotFound. when we use gorm to find models, if there are not related records, an error "record not found" will be returned.

func ReverseSlice

func ReverseSlice(data interface{})

ReverseSlice is used to reverse a slice

func Sha256Hash2String

func Sha256Hash2String(p []byte) (string, error)

Sha256Hash2String will hash bytes to string, if some errors happened, an error will be returned.

func SubStrFromTo

func SubStrFromTo(s string, from, to int) string

SubStrFromTo will truncate the specific string by parameters

func SubStrFromToEnd

func SubStrFromToEnd(s string, from int) string

SubStrFromToEnd will truncate the specific string by parameters

Types

This section is empty.

Jump to

Keyboard shortcuts

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