clone
This commit is contained in:
1
vendor/github.com/asdine/storm/v3/codec/.gitignore
generated
vendored
Normal file
1
vendor/github.com/asdine/storm/v3/codec/.gitignore
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
*.db
|
11
vendor/github.com/asdine/storm/v3/codec/codec.go
generated
vendored
Normal file
11
vendor/github.com/asdine/storm/v3/codec/codec.go
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
// Package codec contains sub-packages with different codecs that can be used
|
||||
// to encode and decode entities in Storm.
|
||||
package codec
|
||||
|
||||
// MarshalUnmarshaler represents a codec used to marshal and unmarshal entities.
|
||||
type MarshalUnmarshaler interface {
|
||||
Marshal(v interface{}) ([]byte, error)
|
||||
Unmarshal(b []byte, v interface{}) error
|
||||
// name of this codec
|
||||
Name() string
|
||||
}
|
25
vendor/github.com/asdine/storm/v3/codec/json/json.go
generated
vendored
Normal file
25
vendor/github.com/asdine/storm/v3/codec/json/json.go
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
// Package json contains a codec to encode and decode entities in JSON format
|
||||
package json
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
const name = "json"
|
||||
|
||||
// Codec that encodes to and decodes from JSON.
|
||||
var Codec = new(jsonCodec)
|
||||
|
||||
type jsonCodec int
|
||||
|
||||
func (j jsonCodec) Marshal(v interface{}) ([]byte, error) {
|
||||
return json.Marshal(v)
|
||||
}
|
||||
|
||||
func (j jsonCodec) Unmarshal(b []byte, v interface{}) error {
|
||||
return json.Unmarshal(b, v)
|
||||
}
|
||||
|
||||
func (j jsonCodec) Name() string {
|
||||
return name
|
||||
}
|
Reference in New Issue
Block a user