Popularity
1.2
Growing
Activity
0.0
Declining
9
1
3
Programming language: Go
License: MIT License
Latest version: v1.3.0
epoch alternatives and similar packages
Based on the "JSON" category.
Alternatively, view epoch alternatives based on common mentions on social networks and blogs.
-
jsonparser
One of the fastest alternative JSON parser for Go that does not require schema -
fastjson
Fast JSON parser and validator for Go. No custom structs, no code generation, no reflection -
jsondiff
Compute the diff between two JSON documents as a series of RFC6902 (JSON Patch) operations -
JSON-to-Proto
convert JSON to Protocol Buffers online in your browser instantly -
ujson
µjson - A fast and minimal JSON parser and transformer that works on unstructured JSON -
go-jsonerror
Small package which wraps error responses to follow jsonapi.org -
mapslice-json
Go MapSlice for ordered marshal/ unmarshal of maps in JSON -
ask
A Go package that provides a simple way of accessing nested properties in maps and slices. -
go-parameters
:blue_book: Easily parse incoming parameters and values from an HTTP request
Static code analysis for 29 languages.
Your projects are multi-language. So is SonarQube analysis. Find Bugs, Vulnerabilities, Security Hotspots, and Code Smells so you can release quality code every time. Get started analyzing your projects today for free.
Promo
www.sonarqube.org
Do you think we are missing an alternative of epoch or a related project?
README
epoch
Contains primitives for marshaling/unmarshaling Unix timestamp/epoch to/from built-in time.Time type in JSON.
Seconds
Seconds since the Epoch(Unix time), e.g.:
{"timestamp":1136239445}
Inherits built-in time.Time type, thus has all it methods, but has custom serializer and deserializer(converts integer into built-in time.Time and vice versa).
Usage Example
package main
import (
"encoding/json"
"fmt"
"github.com/vtopc/epoch"
)
type Request struct {
Timestamp epoch.Seconds `json:"timestamp"`
}
func main() {
var v Request
err := json.Unmarshal([]byte(`{"timestamp":1136239445}`), &v)
if err != nil {
panic(err)
}
fmt.Printf("%+v\n", v)
// Output: {Timestamp:2006-01-03 00:04:05 +0200 EET}
// Also as epoch.Seconds inherits all time.Time's methods one can do next:
fmt.Println(v.Timestamp.Year())
// Output: 2006
fmt.Println(v.Timestamp.UTC().String())
// Output: 2006-01-02 22:04:05 +0000 UTC
}
Milliseconds
Same as epoch.Seconds, but for Epoch(Unix time) in milliseconds, e.g.:
{"timestamp":1136239445999}
StrSeconds
Same as epoch.Seconds, but for strings, e.g.:
{"timestamp":"1136239445"}
StrMilliseconds
Same as epoch.Milliseconds, but for strings, e.g.:
{"timestamp":"1136239445999"}