Documentation ¶
Index ¶
- Constants
- Variables
- func CreateOrOpenFile(path string) (*os.File, error)
- func GetModuleName() (string, error)
- func Map[T any, U any](slice []T, f func(T) U) []U
- func MigrationFileFormat(t time.Time, name string) string
- func MigrationStructName(t time.Time, name string) string
- func MustJSON(v interface{}) string
- func NilOrValue[T any](t T) *T
- func PanicToError(fn func()) (err error)
- func PanicToError1[Out any](fn func() Out) (out Out, err error)
- func Parentheses(in string) string
- func ParseMigrationVersion(f string) (string, error)
- func Ptr[T any](t T) *T
- func RemoveConsecutiveSpaces(s string) (string, error)
- func StrFunc[T any](val T) func() string
- func StrFuncPredicate[T any](condition bool, val T) func() string
- func StringJoin[T any](slice []T, sep string) string
- type Replacer
Constants ¶
View Source
const FormatTime = "20060102150405"
Variables ¶
View Source
var FileRegexp = regexp.MustCompile(`(\d{14})_(.*)\.go`)
View Source
var TimeRegexp = regexp.MustCompile(`\d{14}`)
Functions ¶
func GetModuleName ¶
func NilOrValue ¶
func NilOrValue[T any](t T) *T
NilOrValue If the value is a default value for the type, it returns nil else it returns the value.
func PanicToError ¶
func PanicToError(fn func()) (err error)
func PanicToError1 ¶
func Parentheses ¶
func ParseMigrationVersion ¶
func RemoveConsecutiveSpaces ¶
RemoveConsecutiveSpaces Remove all whitespace not between matching unescaped quotes. Example: SELECT * FROM "table" WHERE "column" = 'value ' Result: SELECT * FROM "table" WHERE "column" = 'value '
func StrFuncPredicate ¶
func StringJoin ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.