mirror of
https://github.com/jimeh/go-render.git
synced 2026-02-19 03:16:39 +00:00
refactor: focus around Render/Compact/Pretty/NewWith functions
This is yet another drastic refactor of public API and concepts. Hopefully the last one, as I'm now fairly happy with things.
This commit is contained in:
@@ -10,7 +10,10 @@ import (
|
||||
// interface.
|
||||
type Binary struct{}
|
||||
|
||||
var _ FormatRenderer = (*Binary)(nil)
|
||||
var (
|
||||
_ Handler = (*Binary)(nil)
|
||||
_ FormatsHandler = (*Binary)(nil)
|
||||
)
|
||||
|
||||
// Render writes result of calling MarshalBinary() on v. If v does not implment
|
||||
// encoding.BinaryMarshaler the ErrCannotRander error will be returned.
|
||||
@@ -33,6 +36,7 @@ func (br *Binary) Render(w io.Writer, v any) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Formats returns a list of format strings that this Handler supports.
|
||||
func (br *Binary) Formats() []string {
|
||||
return []string{"binary", "bin"}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user