gvar_is.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. package gvar
  7. import (
  8. "github.com/gogf/gf/internal/utils"
  9. )
  10. // IsNil checks whether `v` is nil.
  11. func (v *Var) IsNil() bool {
  12. return utils.IsNil(v.Val())
  13. }
  14. // IsEmpty checks whether `v` is empty.
  15. func (v *Var) IsEmpty() bool {
  16. return utils.IsEmpty(v.Val())
  17. }
  18. // IsInt checks whether `v` is type of int.
  19. func (v *Var) IsInt() bool {
  20. return utils.IsInt(v.Val())
  21. }
  22. // IsUint checks whether `v` is type of uint.
  23. func (v *Var) IsUint() bool {
  24. return utils.IsUint(v.Val())
  25. }
  26. // IsFloat checks whether `v` is type of float.
  27. func (v *Var) IsFloat() bool {
  28. return utils.IsFloat(v.Val())
  29. }
  30. // IsSlice checks whether `v` is type of slice.
  31. func (v *Var) IsSlice() bool {
  32. return utils.IsSlice(v.Val())
  33. }
  34. // IsMap checks whether `v` is type of map.
  35. func (v *Var) IsMap() bool {
  36. return utils.IsMap(v.Val())
  37. }
  38. // IsStruct checks whether `v` is type of struct.
  39. func (v *Var) IsStruct() bool {
  40. return utils.IsStruct(v.Val())
  41. }