Categorygithub.com/toqns/sdstore
modulepackage
0.2.5
Repository: https://github.com/toqns/sdstore.git
Documentation: pkg.go.dev

# README

SDStore

Copyright (c) 2022, Toqns Inc.

License

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

# Functions

DecodeFunc wraps the provided function into an DecoderFunc.
EncodeFunc wraps the provided function into an EncoderFunc.
New returns an initialized store with json encoding as default.
NewBincEncoder returns a CodecEncoder using Binc encoding.
NewCborEncoder returns a CodecEncoder using CBOR encoding.
NewMsgpackEncoder returns a CodecEncoder using Msgpack encoding.
WithBincEncoding is an option to set Binc encoding of records.
WithCborEncoding is an option to set CBOR encoding of records.
WithCollectionPerms is an option to set the Collection's permissions for the working directorry and record files.
WithEncoding is an option to set store's encoder and decoder.
WithIndexedFields is an option to set which struct fields are to be indexed.
WithJSONEncoding is an option to set JSON encoding of records.
WithMsgpackEncoding is an option to set Msgpack encoding of records.
WithPerms is an option to set the store's permissions for the working directorry.

# Variables

ErrAlreadyInitialized is an error returned whn a users attempts to initialize an already initialized collection.
ErrInvalidRecordType is an error returned when record data isn't of the expected type.
ErrNotFound is an error returned when a record is not found.
ErrNotIDNotUnique is an error returned when a user attempts to Create a record that already exists.
ErrNotInitialized is an error returned when a user attempts to do an action on a Collection that hasn't been initialized.

# Structs

CodecEncoder provides functionality for encoding/decoding Gob encoded data.
Collection provides functionality to work with records, which are stored as plain files.
IndexedValueNotUniqueError is an error indicating that the value of an indexed field is not unique.
SDStore is a key/value store.

# Interfaces

Decoder is an interface that store decoders have to implement.
Encoder is an interface that store encoders have to implement.

# Type aliases

CollectionOption is an option for the setup of a Collection.
DecoderFunc is a function providing decoding functionality.
EncoderFunc is a function providing encoding functionality.
StoreOption is an option for the setup of a Store.