Documentation ¶
Index ¶
- func DurationToString(dt time.Duration) string
- func StringToDuration(val string) (dt time.Duration, err error)
- type XP
- func (xp XP) As_ArrayDuration(key string) (data []time.Duration)
- func (xp XP) As_ArrayFloat64(key string) (data []float64)
- func (xp XP) As_ArrayInt(key string) (data []int)
- func (xp XP) As_ArrayMapString(key string, fields ...string) (data []map[string]string)
- func (xp XP) As_ArrayString(key string) (data []string)
- func (xp XP) As_ArrayXP(key string) (data []XP)
- func (xp XP) As_Bool(key string) (b bool)
- func (xp XP) As_Float64(key string) (f float64)
- func (xp XP) As_Int(key string) (n int)
- func (xp XP) As_Int64(key string) (n int64)
- func (xp XP) As_MapInt(key string) (data map[string]int64)
- func (xp XP) As_MapString(key string) (data map[string]string)
- func (xp XP) As_ObjectId(key string) (id *bson.ObjectId)
- func (xp XP) As_String(key string) (str string)
- func (xp XP) As_StringEmail(key string) string
- func (xp XP) As_StringNil(key string) (str *string)
- func (xp XP) As_Time(key string) (t time.Time)
- func (xp XP) As_TimeDuration(key string) (d time.Duration)
- func (xp XP) As_XP(key string) (data XP)
- func (xp XP) Get_HttpRequest() (req *http.Request)
- func (xp XP) Get_HttpResponseWriter() (rw http.ResponseWriter)
- func (xp XP) Get_SessionValues() (vals map[string]string)
- func (xp XP) MustBe_ObjectId(key string) (id bson.ObjectId, err error)
- func (xp XP) To_String(to *map[string]string, key string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DurationToString ¶
Converts duration into string notation, ie: 1d, 1h, 1m The smallest interval is 1m. Smaller values replaced with 1m.
Types ¶
type XP ¶
type XP map[string]interface{}
func New_FromMetaData ¶
Creates new XP from supplied data and its metadata.
func (XP) As_ArrayDuration ¶
Gets parameter as time.Duration array.
func (XP) As_ArrayFloat64 ¶
Gets parameter as float64 array.
func (XP) As_ArrayInt ¶
Gets parameter as int array.
func (XP) As_ArrayMapString ¶
Gets parameter as array of string maps.
func (XP) As_ArrayString ¶
Gets parameter as string array.
func (XP) As_ArrayXP ¶
Gets parameter as array of xparams.
func (XP) As_Bool ¶
Gets parameter as bool. Can be either pure JSON bool or "true" string. All other stings including empty will be treated as false.
func (XP) As_MapString ¶
Gets parameter as map of string to sting.
func (XP) As_ObjectId ¶
Gets key value as if it should be bson.ObjectId.
func (XP) As_StringEmail ¶
Gets parameter as email address string (trimmed & lower cased).
func (XP) As_StringNil ¶
Gets parameter as string pointer allowing for the nil option.
func (XP) As_Time ¶
Gets parameter as time. Call t.IsZero() to check for error. IMPORTANT: correct time format is "2014-11-19T00:00:00-08:00" for a specific time zone, or "2006-01-02T15:04:05Z" for UTC. See http://www.ietf.org/rfc/rfc3339.txt
func (XP) As_TimeDuration ¶
Gets parameter as time duration.
func (XP) Get_HttpResponseWriter ¶
func (xp XP) Get_HttpResponseWriter() (rw http.ResponseWriter)
Gets http.ResponseWriter.
func (XP) Get_SessionValues ¶
Gets session values.
func (XP) MustBe_ObjectId ¶
Gets key value as bson.ObjectId.