devschema

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPrefix    = "ent_dev"
	DefaultPruneDays = 30
	MaxSchemaLen     = 63
)

Variables

This section is empty.

Functions

func EnsureRegistry

func EnsureRegistry(db *sqlx.DB) error

func EnsureSchema

func EnsureSchema(db *sqlx.DB, schemaName string) error

func PruneSchemas

func PruneSchemas(db *sqlx.DB, opts PruneOptions) ([]string, error)

func ResolveGitBranch

func ResolveGitBranch(repoRoot string) string

func TouchSchema

func TouchSchema(db *sqlx.DB, schemaName, branchName string) error

func WriteState

func WriteState(res *Result, opts Options) error

Types

type Config

type Config struct {
	Enabled        bool
	SchemaName     string
	IncludePublic  bool
	IgnoreBranches []string
	PruneEnabled   bool
	PruneDays      int
}

type Options

type Options struct {
	NodeEnv    string
	RepoRoot   string
	SchemaPath string
}

type PruneOptions

type PruneOptions struct {
	Prefix string
	Days   int
	DryRun bool
}

type Result

type Result struct {
	Enabled        bool
	SchemaName     string
	BranchName     string
	IncludePublic  bool
	IgnoreBranches []string
	PruneEnabled   bool
	PruneDays      int
}

func Resolve

func Resolve(cfg *Config, opts Options) (*Result, error)

func WriteStateFromConfig

func WriteStateFromConfig(cfg *Config, opts Options) (*Result, error)

type State

type State struct {
	SchemaName     string   `json:"schemaName"`
	BranchName     string   `json:"branchName,omitempty"`
	IncludePublic  bool     `json:"includePublic"`
	IgnoreBranches []string `json:"ignoreBranches,omitempty"`
	PruneEnabled   bool     `json:"pruneEnabled,omitempty"`
	PruneDays      int      `json:"pruneDays,omitempty"`
}

func LoadState

func LoadState(opts Options) (*State, error)

Jump to

Keyboard shortcuts

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