Documentation ¶
Index ¶
- func Empty(i interface{}) bool
- func GetEnv(key string, fallback string) string
- func GetFieldPointer(i interface{}, fieldName string) interface{}
- func GetType(v interface{}) string
- func Plural(str string) string
- func PointerToValue(i interface{}) interface{}
- func SetFieldValue(i interface{}, field string, value interface{})
- func Singular(str string) string
- func ToCamel(str string) string
- func ToKebab(str string) string
- func ToPascal(str string) string
- func ToScreamingKebab(str string) string
- func ToScreamingSnake(str string) string
- func ToSnake(str string) string
- type BaseTaggable
- type CORS
- type FieldData
- type Taggable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetEnv ¶ added in v0.1.2
GetEnv get the environment variable and set it to given fallback if not present
func GetFieldPointer ¶
func GetFieldPointer(i interface{}, fieldName string) interface{}
GetFieldPointer returns a pointer to given struct field with given field name
func GetType ¶
func GetType(v interface{}) string
GetType get the type name of a struct variable For example, if v is an int, GetType(v) return int as string Or if v is a struct or custom type, GetType(v) return type name
func PointerToValue ¶
func PointerToValue(i interface{}) interface{}
PointerToValue converts given variable (if it is a pointer) to its value
func SetFieldValue ¶
func SetFieldValue(i interface{}, field string, value interface{})
SetFieldValue sets value of field with given name in given struct with given value
func ToCamel ¶
ToCamel convert given string case to camel case For example, if str is like "example_string" or "ExampleString" the output will be exampleString
func ToKebab ¶
ToKebab is similar to ToSnake but instead of using underscore, it uses dash. For example, if str is like "exampleString" or "ExampleString" the output will be example-string
func ToPascal ¶
ToPascal convert given string case to pascal case For example, if str is like "example_string" or "exampleString" the output will be ExampleString
func ToScreamingKebab ¶
ToScreamingKebab is similar to ToScreamingSnake but instead of using underscore, it uses dash. For example, if str is like "exampleString" or "ExampleString" the output will be EXAMPLE-STRING
func ToScreamingSnake ¶
ToScreamingSnake convert given string case to all capital snake case. For example, if str is like "exampleString" or "ExampleString" the output will be EXAMPLE_STRING
Types ¶
type BaseTaggable ¶ added in v0.1.4
type BaseTaggable struct{}
BaseTaggable is a base struct for helper for struct needed to implement Taggable interface
type CORS ¶ added in v0.1.8
type CORS struct { AllowedOrigins []string AllowedMethods []string AllowedHeaders []string DisableCredentials bool }
CORS is struct containing data of CORS related headers.
type FieldData ¶
type FieldData struct { Name string Type reflect.Type Tags reflect.StructTag Value interface{} Exported bool Anonymous bool }
FieldData containing struct field data such as name, type and tag
func GetStructFieldsData ¶
GetStructFieldsData analyze the given struct and return information about exported fields such as name, type and tag value