Skip to content

Commit

Permalink
Merge pull request #138 from philippgille/move-proto-codec-to-separat…
Browse files Browse the repository at this point in the history
…e-go-module

Move proto codec to separate Go module
  • Loading branch information
philippgille authored Nov 4, 2023
2 parents e95ea56 + 2a8d6e7 commit 087cefb
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 13 deletions.
2 changes: 0 additions & 2 deletions encoding/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,4 @@ var (
JSON = JSONcodec{}
// Gob is a GobCodec that encodes/decodes Go values to/from gob.
Gob = GobCodec{}
// PB is a PBcodec that encodes/decodes Go values to/from Protocol Buffers.
PB = PBcodec{}
)
2 changes: 0 additions & 2 deletions encoding/go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
module github.com/philippgille/gokv/encoding

go 1.18

require google.golang.org/protobuf v1.31.0
8 changes: 0 additions & 8 deletions encoding/go.sum
Original file line number Diff line number Diff line change
@@ -1,8 +0,0 @@
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
5 changes: 5 additions & 0 deletions encoding/proto/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/philippgille/gokv/encoding/proto

go 1.18

require google.golang.org/protobuf v1.31.0
8 changes: 8 additions & 0 deletions encoding/proto/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
9 changes: 8 additions & 1 deletion encoding/proto.go → encoding/proto/proto.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
package encoding
package proto

import (
"errors"

"google.golang.org/protobuf/proto"
)

// Convenience variable for simpler usage in gokv store options.
//
// options := redis.Options{
// Encoding: proto.Codec,
// }
var Codec = PBcodec{}

// PBcodec encodes/decodes Go values to/from protocol buffers.
type PBcodec struct{}

Expand Down

0 comments on commit 087cefb

Please sign in to comment.