Skip to content

Commit

Permalink
new: add Marshaler interface
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Jun 27, 2021
1 parent 05fdce3 commit 9c57eb2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,16 @@ func (ma *MyApp) SetCacher(cacher gsr.SimpleCacher) {
}
```

### Marshaler interface

```go
// Marshaler interface for Marshal/Unmarshal data
type Marshaler interface {
Marshal(v interface{}) ([]byte, error)
Unmarshal(data []byte, ptr interface{}) error
}
```

## LICENSE

[MIT](LICENSE)
7 changes: 7 additions & 0 deletions marshaler.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package gsr

// Marshaler interface for Marshal/Unmarshal data
type Marshaler interface {
Marshal(v interface{}) ([]byte, error)
Unmarshal(data []byte, ptr interface{}) error
}

0 comments on commit 9c57eb2

Please sign in to comment.