SQL Builder panics on invalid SQL.
Query execution panics on invalid destination.
This commit is contained in:
parent
14c2c9d745
commit
486e45db5c
42 changed files with 357 additions and 713 deletions
|
|
@ -144,3 +144,28 @@ func FormatTimestamp(t time.Time) []byte {
|
|||
func IsNil(v interface{}) bool {
|
||||
return v == nil || (reflect.ValueOf(v).Kind() == reflect.Ptr && reflect.ValueOf(v).IsNil())
|
||||
}
|
||||
|
||||
func MustBe(v interface{}, kind reflect.Kind, errorStr string) {
|
||||
if reflect.TypeOf(v).Kind() != kind {
|
||||
panic(errorStr)
|
||||
}
|
||||
}
|
||||
|
||||
func ValueMustBe(v reflect.Value, kind reflect.Kind, errorStr string) {
|
||||
if v.Kind() != kind {
|
||||
panic(errorStr)
|
||||
}
|
||||
}
|
||||
|
||||
func TypeMustBe(v reflect.Type, kind reflect.Kind, errorStr string) {
|
||||
if v.Kind() != kind {
|
||||
panic(errorStr)
|
||||
}
|
||||
}
|
||||
|
||||
func MustBeInitializedPtr(val interface{}, errorStr string) {
|
||||
if IsNil(val) {
|
||||
panic(errorStr)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue