storage

package
v0.0.0-...-06d85a1 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(conf config.Database) (err error)

Migrate performs database migrations depending on the given configuration.

func MigrateDown

func MigrateDown(engine, uri string) (err error)

MigrateDown undoes all database migrations, reverting the schema to the initial state.

func MigrateDownTo

func MigrateDownTo(engine, uri string, p int64) (err error)

MigrateDownTo undoes database migrations down to a specific version.

func MigrateReset

func MigrateReset(engine, uri string) (err error)

MigrateReset roll back all migrations.

func MigrateStatus

func MigrateStatus(engine, uri string) (err error)

MigrateStatus displays the status of all migrations.

func MigrateUp

func MigrateUp(engine, uri string) (err error)

MigrateUp performs all available database migrations to update the schema to the latest version.

func MigrateUpTo

func MigrateUpTo(engine, uri string, p int64) (err error)

MigrateUpTo performs database migrations up to a specific version.

Types

type DataReader

type DataReader interface {
	// ReadUsers - Read users from the storage.
	ReadUsers(ctx context.Context, pagination database.Pagination) (users []*basev1.User, err error)
}

DataReader - Interface for reading Data from the storage.

func NewNoopDataReader

func NewNoopDataReader() DataReader

type DataWriter

type DataWriter interface {
	Write(ctx context.Context, name string) (err error)
}

func NewNoopDataWriter

func NewNoopDataWriter() DataWriter

type NoopDataReader

type NoopDataReader struct{}

func (*NoopDataReader) ReadUsers

func (f *NoopDataReader) ReadUsers(_ context.Context, _ database.Pagination) ([]*basev1.User, error)

type NoopDataWriter

type NoopDataWriter struct{}

func (*NoopDataWriter) Write

func (n *NoopDataWriter) Write(_ context.Context, _ string) error

type User

type User struct {
	ID        uint64
	Name      string
	CreatedAt time.Time
}

User is the model for the user entity.

func (User) ToProto

func (r User) ToProto() *basev1.User

ToProto - Convert database user to base user

Directories

Path Synopsis
decorators

Jump to

Keyboard shortcuts

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