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

sqlite

package
v0.42.4 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Overview

Package sqlite reads v1 c1z files without modifying their SQLite database.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoSyncRuns = errors.New("sqlite: source has no sync runs")

ErrNoSyncRuns reports that the source has no sync_runs rows.

Functions

This section is empty.

Types

type ConvertOption

type ConvertOption func(*convertConfig)

ConvertOption configures ToPebble and ToPebbleOpen.

func WithBatchSize

func WithBatchSize(n int) ConvertOption

WithBatchSize sets the number of records passed to each bulk-import call.

func WithConvertTmpDir

func WithConvertTmpDir(dir string) ConvertOption

WithConvertTmpDir sets the destination engine's temporary directory.

func WithParallelism

func WithParallelism(n int) ConvertOption

WithParallelism sets the grant scan lane count.

func WithResolveBehavior

func WithResolveBehavior(behavior ResolveBehavior) ConvertOption

WithResolveBehavior selects how an empty source sync ID is resolved.

type ConvertStageStats

type ConvertStageStats struct {
	Rows     int64
	Duration time.Duration
}

ConvertStageStats records the rows and elapsed time for one conversion stage.

type ConvertStats

type ConvertStats struct {
	SourceSyncID   string
	DestSyncID     string
	ResourceTypes  ConvertStageStats
	Resources      ConvertStageStats
	Entitlements   ConvertStageStats
	Grants         ConvertStageStats
	Assets         ConvertStageStats
	AssetBytes     int64
	Sessions       ConvertStageStats
	DiscardedSyncs []DiscardedSync
	Total          time.Duration
	// contains filtered or unexported fields
}

ConvertStats reports conversion row counts, timing, and omitted source syncs.

type DiscardedSync

type DiscardedSync struct {
	ID        string
	Type      connectorstore.SyncType
	StartedAt *time.Time
	EndedAt   *time.Time
}

DiscardedSync describes a source sync omitted from the single-sync destination.

type File

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

File is an open read-only v1 SQLite source.

func Open

func Open(ctx context.Context, path string, opts ...OpenOption) (_ *File, err error)

Open opens a v1 c1z envelope or bare SQLite database read-only.

func (*File) Close

func (f *File) Close(context.Context) error

Close releases the source database and removes any decoded temporary file.

func (*File) ResolveSyncID

func (f *File) ResolveSyncID(ctx context.Context, behavior ResolveBehavior) (string, error)

ResolveSyncID applies behavior to the source sync runs.

func (*File) SyncRuns

func (f *File) SyncRuns(ctx context.Context) ([]*c1zstore.SyncRun, error)

SyncRuns returns every source sync in insertion order.

func (*File) ToPebble

func (f *File) ToPebble(
	ctx context.Context,
	outPath string,
	sourceSyncID string,
	opts ...ConvertOption,
) (*ConvertStats, error)

ToPebble converts one source sync and closes the destination store.

func (*File) ToPebbleOpen

func (f *File) ToPebbleOpen(
	ctx context.Context,
	outPath string,
	sourceSyncID string,
	opts ...ConvertOption,
) (_ c1zstore.Store, _ *ConvertStats, err error)

ToPebbleOpen converts one source sync and returns the destination store open. Callers that bind the converted sync and mutate records must clear inherited ingest-invariant verification, call EndSync, and restore the converted sync's source timestamps through pebble.AsEngine before Close.

type OpenOption

type OpenOption func(*openConfig)

OpenOption configures Open.

func WithDecoderOptions

func WithDecoderOptions(opts ...dotc1z.DecoderOption) OpenOption

WithDecoderOptions passes options to the v1 c1z decoder.

func WithTmpDir

func WithTmpDir(dir string) OpenOption

WithTmpDir sets the directory used for a decoded v1 c1z database.

type ResolveBehavior

type ResolveBehavior string

ResolveBehavior selects how an empty source sync ID is resolved.

const (
	// ResolveNewest selects the newest finished or resumable sync before abandoned unfinished syncs.
	ResolveNewest ResolveBehavior = "newest"
	// ResolveFullFinished selects the latest finished full sync.
	ResolveFullFinished ResolveBehavior = "full_finished"
)

Jump to

Keyboard shortcuts

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