github.com/gogf/gf/v2@v2.7.4/container/gvar/gvar_is.go (about) 1 // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. 2 // 3 // This Source Code Form is subject to the terms of the MIT License. 4 // If a copy of the MIT was not distributed with this file, 5 // You can obtain one at https://github.com/gogf/gf. 6 7 package gvar 8 9 import ( 10 "github.com/gogf/gf/v2/internal/utils" 11 ) 12 13 // IsNil checks whether `v` is nil. 14 func (v *Var) IsNil() bool { 15 return utils.IsNil(v.Val()) 16 } 17 18 // IsEmpty checks whether `v` is empty. 19 func (v *Var) IsEmpty() bool { 20 return utils.IsEmpty(v.Val()) 21 } 22 23 // IsInt checks whether `v` is type of int. 24 func (v *Var) IsInt() bool { 25 return utils.IsInt(v.Val()) 26 } 27 28 // IsUint checks whether `v` is type of uint. 29 func (v *Var) IsUint() bool { 30 return utils.IsUint(v.Val()) 31 } 32 33 // IsFloat checks whether `v` is type of float. 34 func (v *Var) IsFloat() bool { 35 return utils.IsFloat(v.Val()) 36 } 37 38 // IsSlice checks whether `v` is type of slice. 39 func (v *Var) IsSlice() bool { 40 return utils.IsSlice(v.Val()) 41 } 42 43 // IsMap checks whether `v` is type of map. 44 func (v *Var) IsMap() bool { 45 return utils.IsMap(v.Val()) 46 } 47 48 // IsStruct checks whether `v` is type of struct. 49 func (v *Var) IsStruct() bool { 50 return utils.IsStruct(v.Val()) 51 }