Documentation
¶
Index ¶
- Variables
- func IsCanonicalMetadata(m models.Metadata) bool
- type KeeperType
- type Metadata
- func (m *Metadata) AddStore(name string)
- func (m *Metadata) Close() error
- func (m *Metadata) Ping()
- func (m *Metadata) RemoveStore(name string)
- func (m *Metadata) Sync() error
- func (m *Metadata) Timestamp() time.Time
- func (m *Metadata) Type() string
- func (m *Metadata) WithBackups(backups ...models.Backup) *Metadata
- func (m *Metadata) WithCreated(created time.Time) *Metadata
- func (m *Metadata) WithDefaultStoreOpts(opts any) *Metadata
- func (m *Metadata) WithExtra(extra map[string]interface{}) *Metadata
- func (m *Metadata) WithLastOpened(lastOpened time.Time) *Metadata
- func (m *Metadata) WithStores(stores ...string) *Metadata
- func (m *Metadata) WithWriter(w io.WriteSeeker) *Metadata
- type Placeholder
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotCanonicalMetadata = errors.New("metadata is of a different type, cannot cast")
Functions ¶
func IsCanonicalMetadata ¶ added in v0.4.2
Types ¶
type KeeperType ¶ added in v0.4.2
type KeeperType string
type Metadata ¶
type Metadata struct { KeeperType string `json:"type"` Created time.Time `json:"created,omitempty"` LastOpened time.Time `json:"last_opened,omitempty"` KnownStores []string `json:"stores,omitempty"` Backups map[string]any `json:"backups,omitempty"` Extra map[string]interface{} `json:"extra,omitempty"` DefStoreOpts any `json:"default_store_opts,omitempty"` // contains filtered or unexported fields }
Metadata is a struct that holds the metadata for a [Keeper]'s DB. This is critical for migrating data between [Keeper]s. The only absolute requirement is that the [Type] field is set.
func NewMeta ¶
func NewMeta(keeperType KeeperType) *Metadata
func NewMetaFile ¶
func OpenMetaFile ¶
func (*Metadata) Close ¶
Close calls [Sync] and then closes the metadata writer, if it is an io.Closer.
func (*Metadata) RemoveStore ¶
func (*Metadata) Sync ¶
Sync writes the metadata to the designated io.Writer. If there is no writer, it will create "meta.json" at m.path.
func (*Metadata) WithDefaultStoreOpts ¶ added in v0.4.2
func (*Metadata) WithStores ¶
func (*Metadata) WithWriter ¶
func (m *Metadata) WithWriter(w io.WriteSeeker) *Metadata
type Placeholder ¶ added in v0.4.2
type Placeholder struct {
// contains filtered or unexported fields
}
func NewPlaceholder ¶ added in v0.4.2
func NewPlaceholder(name string) Placeholder
func (Placeholder) Timestamp ¶ added in v0.4.2
func (d Placeholder) Timestamp() time.Time
func (Placeholder) Type ¶ added in v0.4.2
func (d Placeholder) Type() string
Click to show internal directories.
Click to hide internal directories.