Documentation
¶
Index ¶
- func GetModelFieldTypeElmIfValid(modelObj interface{}, fieldName string) (reflect.Type, error)
- func GetModelFieldTypeIfValid(modelObj interface{}, fieldName string) (reflect.Type, error)
- func TransformFieldValue(typeInString string, fieldValue string) (interface{}, error)
- func TransformFieldValues(typeInString string, fieldValues []string) ([]interface{}, error)
- type EWKBPoint
- type EWKBPolygon
- type FieldNotInModelError
- type FilterFunc
- type SetString
- func (s *SetString) Add(v string)
- func (s *SetString) AddMulti(List ...string)
- func (s *SetString) Clear()
- func (s *SetString) Difference(s2 *SetString) *SetString
- func (s *SetString) Filter(P FilterFunc) *SetString
- func (s *SetString) Has(v string) bool
- func (s *SetString) Intersect(s2 *SetString) *SetString
- func (s *SetString) Remove(v string)
- func (s *SetString) Size() int
- func (s *SetString) Union(s2 *SetString) *SetString
- type TimeM
- type UUID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetModelFieldTypeElmIfValid ¶
GetModelFieldTypeElmIfValid is like GetModelFieldTypeIfValid, but get the element if it is array
func GetModelFieldTypeIfValid ¶
GetModelFieldTypeIfValid make sure the fieldName is in the modelObj, and find the correct reflect.Type func GetModelFieldTypeIfValid(modelObj mdl.IModel, fieldName string) (reflect.Type, error) { If this is an array, get the actual type instead of the array type
func TransformFieldValue ¶
TransformFieldValue transforms type in URL parameter to the proper data types
func TransformFieldValues ¶
TransformFieldValues transforms type in URL parameters to the proper data types
Types ¶
type EWKBPoint ¶
EWKBPoint encapsulate Point and handles value and scanners to work with Gorm Fetch by .Point.X(), .Point.Y()
func NewEWKBPoint ¶
NewEWKBPoint creates a new EWKBPoint
func (*EWKBPoint) MarshalJSON ¶
MarshalJSON customizes unmarshalling from JSON array (e.g. [10, 20])
func (*EWKBPoint) Scan ¶
Scan satisfies the Scanner interace and is responsible for reading data from the database
func (*EWKBPoint) UnmarshalJSON ¶
UnmarshalJSON json satisfies the JSON library
{
"type": "Point",
"coordinates": [30, 10]
}
type EWKBPolygon ¶
EWKBPolygon encapsulate Polygon and handles value and scanners to work with Gorm
func (*EWKBPolygon) MarshalJSON ¶
func (m *EWKBPolygon) MarshalJSON() ([]byte, error)
MarshalJSON customizes unmarshalling from JSON array (e.g. [10, 20])
func (*EWKBPolygon) Scan ¶
func (m *EWKBPolygon) Scan(src interface{}) error
Scan satisfies the Scanner interace and is responsible for reading data from the database
func (*EWKBPolygon) UnmarshalJSON ¶
func (m *EWKBPolygon) UnmarshalJSON(b []byte) (err error)
UnmarshalJSON json satisfies the JSON library https://en.wikipedia.org/wiki/GeoJSON
{
"type": "Polygon",
"coordinates": [
[[30, 10], [40, 40], [20, 40], [10, 20], [30, 10]]
]
}
type FieldNotInModelError ¶
type FieldNotInModelError struct {
Msg string
}
FieldNotInModelError is for GetModelFieldTypeIfValid. if field doesn't exist in the model, return this error We want to go ahead and skip it since this field may be other options that user can read in hookpoints
func (*FieldNotInModelError) Error ¶
func (r *FieldNotInModelError) Error() string
type FilterFunc ¶
type SetString ¶
type SetString struct {
List map[string]struct{} //empty structs occupy 0 memory
}
func NewSetString ¶
func NewSetString() *SetString
func (*SetString) Difference ¶
Difference returns the subset from s, that doesn't exists in s2 (param)
func (*SetString) Filter ¶
func (s *SetString) Filter(P FilterFunc) *SetString
Filter returns a subset, that contains only the values that satisfies the given predicate P
type TimeM ¶
TimeM (Time convertable from JSON int representing minisecond) encapsulate unix time, converts to and from JSON to Unix time in millisecond
func (*TimeM) MarshalJSON ¶
MarshalJSON customizes unmarshalling from JSON array
func (*TimeM) UnmarshalJSON ¶
UnmarshalJSON unmarshalls it from a string of millisecond
type UUID ¶
UUID string
func NewUUID ¶
func NewUUID() *UUID
NewUUID generates a UUID that's partly V1 and partly V4 Like V4, but use timestamp as part of V1 to increase locality (performance)
func NewUUIDFromString ¶
NewUUIDFromString creates UUID from string
func NewUUIDFromStringNoErr ¶
func (*UUID) MarshalJSON ¶
MarshalJSON customizes unmarshalling from JSON array
func (*UUID) Scan ¶
Scan satisfies the Scanner interace and is responsible for reading data from the database
func (*UUID) String ¶
Value satisfies the Valuer interace and is responsible for writing data to the database
func (*UUID) UnmarshalJSON ¶
UnmarshalJSON unmarshalls it from a string of millisecond