utils

package
v1.3.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ZeroTime0 = "0000-00-00 00:00:00"
	ZeroTime1 = "0001-01-01 00:00:00"
)

represents all zero times

Variables

This section is empty.

Functions

func IndexName

func IndexName(tableName, idxName string) string

IndexName returns index name

func IndexNoCase

func IndexNoCase(s, sep string) int

IndexNoCase index a string in a string with no care of capitalize

func IndexSlice

func IndexSlice(s []string, c string) int

IndexSlice search c in slice s and return the index, return -1 if s don't contain c

func IsArrayZero

func IsArrayZero(v reflect.Value) bool

IsArrayZero returns true is a slice of array is zero

func IsStructZero

func IsStructZero(v reflect.Value) bool

IsStructZero returns true if the Value is a struct and all fields is zero

func IsSubQuery

func IsSubQuery(tbName string) bool

IsSubQuery returns true if it contains a sub query

func IsTimeZero

func IsTimeZero(t time.Time) bool

IsTimeZero return true if a time is zero

func IsValueZero

func IsValueZero(v reflect.Value) bool

IsValueZero returns true if the reflect Value is a zero

func IsZero

func IsZero(k interface{}) bool

IsZero returns false if k is nil or has a zero value

func New

func New(tp reflect.Type, length, cap int) reflect.Value

New creates a value according type

func ReflectValue

func ReflectValue(bean interface{}) reflect.Value

ReflectValue returns value of a bean

func SeqName

func SeqName(tableName string) string

SeqName returns sequence name for some table

func SliceEq

func SliceEq(left, right []string) bool

SliceEq return true if two slice have the same elements even if different sort.

func SplitNNoCase

func SplitNNoCase(s, sep string, n int) []string

SplitNNoCase split n by a separator with no care of capitalize

func SplitNoCase

func SplitNoCase(s, sep string) []string

SplitNoCase split a string by a separator with no care of capitalize

func WriteBuilder

func WriteBuilder(w *builder.BytesWriter, inputs ...BuildReader) error

WriteBuilder writes writers to one

Types

type BuildReader

type BuildReader interface {
	String() string
	Args() []interface{}
}

type Zeroable

type Zeroable interface {
	IsZero() bool
}

Zeroable represents an interface which could know if it's a zero value

Jump to

Keyboard shortcuts

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