svc

package
v0.4.13 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

svc package integration for schema version control.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnableSchemaMigrate

func EnableSchemaMigrate(fs embed.FS, baseDir string, startVersion string, ops ...func(*schemaMigrateOptions))

Enable auto schema migration.

Put all SQL scripts in a specific directory. Embed the directory as follows:

//go:embed schema/managed/*.sql
var schemaFs embed.FS

SQL files should start with 'v' using a name that clearly indicates which version it belongs to, E.g., 'schema/managed/v0.0.1.sql'.

See WithRedisLocker, WithLocker, WithPrevErrIgnored.

func EnableSchemaMigrateOnProd

func EnableSchemaMigrateOnProd(fs embed.FS, baseDir string, startVersion string, ops ...func(*schemaMigrateOptions))

Enable auto schema migration only in production mode.

See EnableSchemaMigrate.

func ExcludeSchemaFile

func ExcludeSchemaFile(name string)

func WithLocker added in v0.3.6

func WithLocker(l Locker) func(*schemaMigrateOptions)

Use custom Locker for schema migration.

func WithPrevErrIgnored added in v0.3.6

func WithPrevErrIgnored() func(*schemaMigrateOptions)

Ignore previous error if any.

func WithRedisLocker added in v0.3.6

func WithRedisLocker() func(*schemaMigrateOptions)

Use Redis as Locker for schema migration.

Types

type LockContext added in v0.3.6

type LockContext struct {
	Rail miso.Rail
	App  string
}

type Locker added in v0.3.6

type Locker interface {
	Lock(lc LockContext) error
	Unlock()
}

Jump to

Keyboard shortcuts

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