serializer

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 7, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodePageToken added in v0.9.0

func DecodePageToken(token string) (time.Time, error)

DecodePageToken converts the given token into a valid timestamp. It returns an error if the token is not a valid representation of a base64-encoded timestamp.

func EncodePageToken added in v0.9.0

func EncodePageToken(t time.Time) string

EncodePageToken converts the given timestamp into a base64-encoded page token.

Types

type API

type API[T any] interface {
	API() T
	FromAPI(in T)
}

API holds a method to convert an underlying implementation to its API counterpart. This method uses generics to support different API entities.

type Format

type Format string
const (
	FormatJSON Format = "json"
	FormatYAML Format = "yaml"
)

type JSON

type JSON interface {
	JSON() ([]byte, error)
	FromJSON(data []byte) error
}

JSON holds a method to convert an underlying implementation to JSON format.

type YAML

type YAML interface {
	YAML() ([]byte, error)
	FromYAML(data []byte) error
}

YAML holds a method to convert an underlying implementation to YAML format.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL