Help us shape the future of Go! Take the 2026 Go Developer Survey

importer

package
v1.4.15 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package importer coordinates portable imports without exposing source credentials. Purpose: shared source contract. Inputs: env-name flags and a started target. Outputs: a verified report. Constraints: sources own extraction only.

Index

Constants

View Source
const PartitionedPrefix = "source table is partitioned (not supported yet): "

PartitionedPrefix starts the E520 message that names an unsupported partitioned source table.

Variables

This section is empty.

Functions

func AllowMessages added in v1.4.15

func AllowMessages(messages ...string)

AllowMessages registers texts that publicError may surface unchanged for E517 and E520 source failures.

func Register

func Register(s Source)

func RegistryErrors

func RegistryErrors() []error

func SystemTables

func SystemTables(schema, name string, storage bool) bool

SystemTables excludes nSelf-owned data, with storage excluded only when enabled.

Types

type Detection

type Detection struct {
	Kind    string   `json:"kind"`
	Version string   `json:"version"`
	Notes   []string `json:"notes"`
	Schemas []string `json:"schemas"`
	// SourceUsers counts the source auth users seen at detection; --plan uses it to run the
	// same auth.users preflight as the real run.
	SourceUsers int `json:"source_users,omitempty"`
	// Objects lists the bucket/key pairs a bundle source will load, for the --plan object-store check.
	// It never reaches the report: keys can be user file names.
	Objects []portable.Object `json:"-"`
}

type Extracted

type Extracted struct {
	Stage                string
	UntranslatedPolicies []Policy
}

Extracted names the written bundle. UntranslatedPolicies lists the source access rules the source could not express as Hasura permissions; they reach the report unchanged.

type FlagSpec

type FlagSpec struct {
	Name, Usage string
	EnvVarName  bool
}

type HasuraReport

type HasuraReport struct {
	Equal bool              `json:"equal"`
	Diffs []verify.Mismatch `json:"diffs"`
}

type Input

type Input struct {
	Values map[string]string
	Env    func(string) string
	Target *config.Config
}

func (Input) Secret

func (in Input) Secret(flag string) (string, error)

type Policy

type Policy struct {
	Table  string `json:"table"`
	Policy string `json:"policy"`
	Reason string `json:"reason"`
}

type Report

type Report struct {
	Source               string        `json:"source"`
	RunID                string        `json:"run_id"`
	Result               string        `json:"result"`
	Tables               []TableReport `json:"tables"`
	Users                UsersReport   `json:"users"`
	Storage              StorageReport `json:"storage"`
	Hasura               HasuraReport  `json:"hasura"`
	UntranslatedPolicies []Policy      `json:"untranslated_policies"`
	// CompatShims names the source objects the bundle's db/compat.sql re-creates in the target.
	CompatShims []string             `json:"compat_shims"`
	Exemptions  []portable.Exemption `json:"exemptions"`
	Mismatches  []verify.Mismatch    `json:"mismatches"`
	Steps       []string             `json:"steps,omitempty"`
	// Wrote is true once the target may have changed; LastStep is the last finished load step.
	Wrote     bool       `json:"wrote"`
	LastStep  string     `json:"last_step,omitempty"`
	Detection *Detection `json:"detection,omitempty"`
}

func Run

func Run(ctx context.Context, cfg *config.Config, s Source, in Input, opts RunOptions) (Report, error)

type ResetUser

type ResetUser struct {
	ID    string `json:"id"`
	Email string `json:"email"`
}

type RunOptions

type RunOptions struct {
	ProjectDir                   string
	Plan, KeepStage, SkipStorage bool
}

type Source

type Source interface {
	Name() string
	Flags() []FlagSpec
	Detect(context.Context, Input) (Detection, error)
	Extract(context.Context, Input, string) (Extracted, error)
}

func Sources

func Sources() []Source

type StorageReport

type StorageReport struct {
	SourceObjects int  `json:"source_objects"`
	TargetObjects int  `json:"target_objects"`
	Equal         bool `json:"equal"`
}

type TableReport

type TableReport struct {
	Schema     string `json:"schema"`
	Name       string `json:"name"`
	SourceRows int64  `json:"source_rows"`
	TargetRows int64  `json:"target_rows"`
	Equal      bool   `json:"equal"`
}

type UsersReport

type UsersReport struct {
	Source        int         `json:"source"`
	Target        int         `json:"target"`
	Equal         bool        `json:"equal"`
	ResetRequired []ResetUser `json:"reset_required"`
}

Directories

Path Synopsis
Package appwrite imports an Appwrite project through its REST API.
Package appwrite imports an Appwrite project through its REST API.
Package firebase registers the Firebase importer source (`nself db import firebase`).
Package firebase registers the Firebase importer source (`nself db import firebase`).
Package hasuracloud registers the hasura-cloud importer.
Package hasuracloud registers the hasura-cloud importer.
Package hasurameta reads a source Hasura's metadata and recomposes a portable bundle.
Package hasurameta reads a source Hasura's metadata and recomposes a portable bundle.
Package load applies verified bundles to fresh, started targets.
Package load applies verified bundles to fresh, started targets.
Package nhost registers the nhost importer.
Package nhost registers the nhost importer.
Package nself registers the portable-bundle importer: the re-import half of `nself db export`.
Package nself registers the portable-bundle importer: the re-import half of `nself db export`.
Package postgres registers the base snapshot importer.
Package postgres registers the base snapshot importer.
Package scratch turns generated DDL and COPY files into a portable Postgres bundle.
Package scratch turns generated DDL and COPY files into a portable Postgres bundle.
Package supabase registers the Supabase importer.
Package supabase registers the Supabase importer.
Package testkit provides isolated source fixtures and target projects.
Package testkit provides isolated source fixtures and target projects.
Package verify defines the importer's zero-mismatch rule.
Package verify defines the importer's zero-mismatch rule.

Jump to

Keyboard shortcuts

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