Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Migrate ¶
func Migrate(txn *badger.Txn) (err error)
Migrate the database to the current version or ensure that the database is current.
func Migration0001 ¶
func Migration0001(txn *badger.Txn) error
Migration0001 converts the key-length based identification of keyspace to a bucket oriented approach with prefixes that will allow us to list objects in the database.
Types ¶
type Migration ¶
type Migration struct { Version uint16 `msgpack:"version"` Applied time.Time `msgpack:"applied"` Previous *Migration `msgpack:"previous"` Migrate MigrateFn `msgpack:"-"` }
Migration represents any changes that must be applied to the database using the MigrateFn defined in the migration. This data structure is saved in the datbase to identify what the database migration is currently at. To define a new migration, create a file with m000n.go then create a migration instance and register it. The store will automatically check the migration is at the latest version or apply the migrations in order if the database is not at the latest version.
func (*Migration) MarshalValue ¶
func (*Migration) UnmarshalValue ¶
type Migrations ¶
type Migrations []*Migration
func (Migrations) HasNext ¶
func (m Migrations) HasNext(n *Migration) bool
func (Migrations) Next ¶
func (m Migrations) Next(n *Migration) *Migration