Documentation ¶
Index ¶
- Constants
- func CheckVersion(version int) error
- func DecompressAndDeserialize(data []byte, result any) error
- func Load(ctx context.Context, r io.Reader, data any) error
- func LoadFromFS(ctx context.Context, fileSystem fs.FS, path string, data any) error
- func LoadFromFile(ctx context.Context, path string, data any) error
- func Save(ctx context.Context, w io.Writer, data any) error
- func SaveToFile(ctx context.Context, path string, data any) error
- func SerializeAndCompress(data any) ([]byte, error)
- type Time
Constants ¶
const ( // CurrentDataVersion holds the current version for data files written with the current release. Note that this is // intentionally the same for all data files that GCS processes. CurrentDataVersion = 5 // FirstGoDataVersion is the version that was written by the first Go version of GCS. FirstGoDataVersion = 4 // MinimumDataVersion holds the oldest version for data files that can be loaded. Note that this is intentionally // the same for all data files that GCS processes. MinimumDataVersion = 2 MinimumLibraryVersion = 3 // Note that as of the Go version of GCS, the data and library version are the same. )
These version numbers are used both as the version of the data files written to disk as well as the major version number for GCS library compatibility checking. The Go release of GCS is the first release to synchronize the data version and the library major version.
Variables ¶
This section is empty.
Functions ¶
func CheckVersion ¶ added in v5.24.0
CheckVersion returns an error if the data version is out of the acceptable range.
func DecompressAndDeserialize ¶
DecompressAndDeserialize decompresses the buffer, then loads JSON data from it.
func LoadFromFS ¶
LoadFromFS loads JSON data from the specified filesystem path.
func LoadFromFile ¶
LoadFromFile loads JSON data from the specified path.
func SaveToFile ¶
SaveToFile writes the data as JSON to the given path. Parent directories will be created automatically, if needed.
func SerializeAndCompress ¶
SerializeAndCompress writes the data as JSON into a buffer, then compresses it.
Types ¶
type Time ¶
Time is a time.Time that has been tailored to be used with JSON in this application.
func NewTimeFrom ¶ added in v5.3.0
NewTimeFrom returns a time & date from a string.
func (Time) Compare ¶ added in v5.19.0
Compare returns an integer comparing this time to the other time.
func (Time) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (*Time) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.