Documentation ¶
Index ¶
- func CompactJSON(v interface{}) string
- func FilePath2Index(in string) (int64, error)
- func FilePath2Suffix(in string) string
- func GetBatchSize(interval float32, fragment int) int
- func GetImagePosition(idx int64, rate float32) int64
- func GetImageSecond(idx int64, rate float32) float64
- func GetMaxFrameLimit(max int, rate float32) int
- func GetRate(interval float32) float32
- func GetSegmentStart(idx int64, seg int) float64
- func GetSize(w, h int) string
- func If(cond bool, tv, fv interface{}) interface{}
- func IndentedJSON(v interface{}) string
- func IsIPv4(v string) bool
- func KVStrings2Map(in ...string) map[string]string
- func LocalIP() (ip net.IP, err error)
- func LocalIPString() (ip string, err error)
- func MapKeys(m map[string]interface{}) []string
- func Md5(byt []byte) string
- func ParseCommaSeparated(in string) []string
- func ReadJSONFromFile(file string, v interface{}) error
- func ReadJSONResponse(resp *http.Response, v interface{}) ([]byte, error)
- func Seconds2ClockDuration(v int64) string
- func StartEndOfTheDay(t time.Time) (time.Time, time.Time)
- func StartEndOfTheMonth(t time.Time) (time.Time, time.Time)
- func StartEndOfTheYear(t time.Time) (time.Time, time.Time)
- func UnmarshalRawMessage(raw json.RawMessage, v interface{}) error
- func WriteJSONToFile(v interface{}, file string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompactJSON ¶
func CompactJSON(v interface{}) string
CompactJSON converts v to compact JSON string
func FilePath2Index ¶
func FilePath2Suffix ¶
func GetBatchSize ¶
func GetImagePosition ¶
func GetImageSecond ¶
func GetMaxFrameLimit ¶
func GetSegmentStart ¶
func IndentedJSON ¶
func IndentedJSON(v interface{}) string
IndentedJSON converts v to JSON string with 4-space indent
func KVStrings2Map ¶ added in v0.1.2
KVStrings2Map converts string pairs to map
func LocalIPString ¶ added in v0.1.2
LocalIPString returns local loopback IP address in string format
func ParseCommaSeparated ¶
ParseCommaSeparated divides the input string seperated by comma (',') into an array
func ReadJSONFromFile ¶ added in v0.1.2
ReadJSONFromFile reads file content as JSON format, and unmarshalls to pointer v NOTE: v must be a pointer
func ReadJSONResponse ¶ added in v0.1.2
ReadJSONResponse reads HTTP response body, unmarshalls the body to pointer v and returns the JSON bytes array NOTE: v must be a pointer
func Seconds2ClockDuration ¶
Seconds2ClockDuration converts seconds to clock like duration, e.g. 4003(s) -> 01:06:43
func StartEndOfTheDay ¶ added in v0.1.2
StartEndOfTheDay returns start and end time of t's day NOTE: timezone is set to UTC
func StartEndOfTheMonth ¶ added in v0.1.2
StartEndOfTheMonth returns start and end time of t's month NOTE: timezone is set to UTC
func StartEndOfTheYear ¶ added in v0.1.2
StartEndOfTheYear returns start and end time of t's year NOTE: timezone is set to UTC
func UnmarshalRawMessage ¶ added in v0.1.2
func UnmarshalRawMessage(raw json.RawMessage, v interface{}) error
UnmarshalRawMessage unmarshalls JSON RawMessage to pointer v NOTE: v must be a pointer
func WriteJSONToFile ¶ added in v0.1.2
WriteJSONToFile marshals v and write to file
Types ¶
This section is empty.