share

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ManifestName                = "manifest.json"
	LastImportSyncScope         = "share:last_import_at"
	LastImportManifestSyncScope = "share:last_import_manifest_generated_at"
	LastImportManifestJSONScope = "share:last_import_manifest_json"
)

Variables

View Source
var (
	ErrNoManifest = snapshot.ErrNoManifest
)
View Source
var SnapshotTables = []string{
	"guilds",
	"channels",
	"members",
	"messages",
	"message_events",
	"message_attachments",
	"mention_events",
	"sync_state",
}

Functions

func Commit

func Commit(ctx context.Context, opts Options, message string) (bool, error)

func EnsureRepo

func EnsureRepo(ctx context.Context, opts Options) error

func ImportEmbeddings

func ImportEmbeddings(ctx context.Context, s *store.Store, opts Options, manifest Manifest) error

func ManifestAlreadyImported

func ManifestAlreadyImported(ctx context.Context, s *store.Store, manifest Manifest) bool

func MarkImported

func MarkImported(ctx context.Context, s *store.Store, manifest Manifest) error

func NeedsImport

func NeedsImport(ctx context.Context, s *store.Store, staleAfter time.Duration) bool

func Pull

func Pull(ctx context.Context, opts Options) error

func Push

func Push(ctx context.Context, opts Options) error

Types

type EmbeddingManifest

type EmbeddingManifest struct {
	Provider     string   `json:"provider"`
	Model        string   `json:"model"`
	InputVersion string   `json:"input_version"`
	Files        []string `json:"files"`
	Columns      []string `json:"columns"`
	Rows         int      `json:"rows"`
}

type FilterOptions added in v0.7.1

type FilterOptions struct {
	PublicOnly        bool
	IncludeChannelIDs []string
	ExcludeChannelIDs []string
}

func (FilterOptions) Active added in v0.7.1

func (o FilterOptions) Active() bool

type ImportProgress

type ImportProgress struct {
	Phase     string
	Table     string
	File      string
	FileIndex int
	FileCount int
	Rows      int
	TotalRows int
}

type Manifest

type Manifest struct {
	Version     int                 `json:"version"`
	GeneratedAt time.Time           `json:"generated_at"`
	Tables      []TableManifest     `json:"tables"`
	Media       *MediaManifest      `json:"media,omitempty"`
	Embeddings  []EmbeddingManifest `json:"embeddings,omitempty"`
	Files       map[string]string   `json:"files,omitempty"`
}

func Export

func Export(ctx context.Context, s *store.Store, opts Options) (Manifest, error)

func Import

func Import(ctx context.Context, s *store.Store, opts Options) (Manifest, error)

func ImportIfChanged

func ImportIfChanged(ctx context.Context, s *store.Store, opts Options) (Manifest, bool, error)

func ImportIncremental

func ImportIncremental(ctx context.Context, s *store.Store, opts Options, previous, manifest Manifest) (Manifest, bool, error)

func PreviousImportedManifest

func PreviousImportedManifest(ctx context.Context, s *store.Store, opts Options) (Manifest, bool)

func ReadManifest

func ReadManifest(repoPath string) (Manifest, error)

type MediaManifest added in v0.8.0

type MediaManifest struct {
	Attachments int                     `json:"attachments"`
	Files       []snapshot.FileManifest `json:"files"`
	Bytes       int64                   `json:"bytes"`
}

type Options

type Options struct {
	RepoPath              string
	CacheDir              string
	Remote                string
	Branch                string
	Filter                FilterOptions
	IncludeMedia          bool
	IncludeEmbeddings     bool
	EmbeddingProvider     string
	EmbeddingModel        string
	EmbeddingInputVersion string
	Progress              func(ImportProgress)
}

type TableManifest

type TableManifest = snapshot.TableManifest

Jump to

Keyboard shortcuts

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