ydbm

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: MIT Imports: 12 Imported by: 0

README

YDB migration tool

PkgGoDev test codecov Go Report Card

Installation

$ go install github.com/alexeyco/ydbm/cmd/ydbm

Generate migration

Work in progress

Documentation

Overview

Package ydbm provides migrations executor.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

Builder describes query builder interface.

type Clock

type Clock interface {
	Now() time.Time
}

Clock describes clock interface.

type Executor

type Executor struct {
	// contains filtered or unexported fields
}

Executor describes migrations executor.

func New

func New(conn *ydb.Driver, opts ...Option) *Executor

New returns new Executor.

func (*Executor) Down

func (e *Executor) Down(ctx context.Context) (err error)

Down decrements database version.

func (*Executor) Register

func (e *Executor) Register(migrations ...migration.Migration) *Executor

Register registers migrations to executor.

func (*Executor) Up

func (e *Executor) Up(ctx context.Context) (err error)

Up increments database version.

func (*Executor) Version

func (e *Executor) Version(ctx context.Context) (version int64, err error)

Version returns current database version.

type Option

type Option func(*Executor)

Option describes executor option.

func WithTableName

func WithTableName(name string) Option

WithTableName sets custom table name.

func WithTablePath

func WithTablePath(path string) Option

WithTablePath sets custom table path.

Directories

Path Synopsis
cmd
ydbm
Package main describes a ydbm entry-point.
Package main describes a ydbm entry-point.
ydbm/cmd
Package cmd provides cli commands.
Package cmd provides cli commands.
internal
builder
Package builder provides query builder.
Package builder provides query builder.
columns
Package columns provides column name constants.
Package columns provides column name constants.
generator
Package generator provides migration generator.
Package generator provides migration generator.
generator/actions/executor
Package executor provides action to generate executor constructor.
Package executor provides action to generate executor constructor.
generator/actions/migration
Package migration provides action to generate migration.
Package migration provides action to generate migration.
generator/context
Package context provides generator context.
Package context provides generator context.
generator/validator
Package validator provides generator validator.
Package validator provides generator validator.
generator/validator/errors
Package errors provides validation errors.
Package errors provides validation errors.
generator/validator/rules
Package rules provides validator rules.
Package rules provides validator rules.
logx
Package logx provides logger.
Package logx provides logger.
templatex
Package templatex provides useful helper to compile and write template to file.
Package templatex provides useful helper to compile and write template to file.
timex
Package timex provides mockable time struct.
Package timex provides mockable time struct.
Package migration provides migration interface.
Package migration provides migration interface.

Jump to

Keyboard shortcuts

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