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

catalogfake

package
v1.152.2 Latest Latest
Warning

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

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

Documentation

Overview

Package catalogfake is an in-memory catalog.Store for tests of the code that writes curation (#1920): it keeps the contract the PostgreSQL store keeps, so a test that passes against it is not passing against a looser store.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {

	// FailWrite, when set, fails every write before anything is applied.
	FailWrite error
	// contains filtered or unexported fields
}

Store is an in-memory catalog.Store holding the contract the PostgreSQL store keeps: every write is versioned per aspect with the value it replaced, WriteAspects and RevertChanges are all-or-nothing, a revert refuses a change its aspect was written after, and a value is normalized as the store normalizes it.

func New

func New() *Store

New returns an empty in-memory catalog.

func (*Store) AddDataset

func (f *Store) AddDataset(connection, path string, columns ...string) catalog.Ref

AddDataset stores a Trino dataset with the given columns and returns its reference.

func (*Store) AddEdges

func (*Store) AddEdges(context.Context, []catalog.Edge) error

AddEdges implements catalog.Store.

func (*Store) Aspects

func (f *Store) Aspects(ref catalog.Ref) catalog.Aspects

Aspects decodes the curation stored on ref.

func (*Store) Browse

Browse implements catalog.Store; the fake holds no browsable levels.

func (*Store) DatasetsByPath

func (f *Store) DatasetsByPath(_ context.Context, connectionKind, path string) ([]string, error)

DatasetsByPath implements catalog.Store.

func (*Store) DeleteDefinition

func (f *Store) DeleteDefinition(ctx context.Context, ref catalog.Ref) error

DeleteDefinition implements catalog.Store, refusing a definition anything carries as the PostgreSQL store does.

func (*Store) GetDataset

func (f *Store) GetDataset(_ context.Context, ref catalog.Ref) (*catalog.Dataset, error)

GetDataset implements catalog.Store.

func (*Store) GetDefinition

func (f *Store) GetDefinition(_ context.Context, ref catalog.Ref) (*catalog.Definition, error)

GetDefinition implements catalog.Store.

func (*Store) History

func (f *Store) History(_ context.Context, ref catalog.Ref, name catalog.AspectName) ([]catalog.Change, error)

History implements catalog.Store.

func (*Store) Lineage

Lineage implements catalog.Store.

func (*Store) ListDefinitions

ListDefinitions implements catalog.Store: the definitions of the kinds asked for, under the parent asked for, ordered by name. Text is ignored.

func (*Store) MarkDatasetRemoved

func (*Store) MarkDatasetRemoved(context.Context, catalog.Ref) error

MarkDatasetRemoved implements catalog.Store.

func (*Store) MarkRemoved

func (*Store) MarkRemoved(context.Context, catalog.Removal) (int, error)

MarkRemoved implements catalog.Store.

func (*Store) PutDataset

PutDataset implements catalog.Store.

func (*Store) PutDefinition

func (f *Store) PutDefinition(_ context.Context, in catalog.DefinitionInput) (*catalog.Definition, error)

PutDefinition implements catalog.Store.

func (*Store) RevertChanges

func (f *Store) RevertChanges(_ context.Context, ids []string, by string) ([]catalog.Change, error)

RevertChanges implements catalog.Store.

func (*Store) Rollback

func (f *Store) Rollback(ctx context.Context, changeID, by string) (*catalog.Change, error)

Rollback implements catalog.Store.

func (*Store) SearchDatasets

SearchDatasets implements catalog.Store.

func (*Store) SetBeforeWrite

func (f *Store) SetBeforeWrite(fn func())

SetBeforeWrite has the next WriteAspects run fn before it checks anything, so a test can land a concurrent write between a plan's read and its write.

func (*Store) SetDescription

func (f *Store) SetDescription(ref, description string)

SetDescription stores a description on the entity ref names, as curation written before the test.

func (*Store) TaggedEntities

func (f *Store) TaggedEntities(_ context.Context, tag string, limit int) ([]string, error)

TaggedEntities implements catalog.Store.

func (*Store) Uses

func (f *Store) Uses(_ context.Context, ref catalog.Ref, limit int) ([]catalog.Use, error)

Uses implements catalog.Store for a tag, a glossary term and a domain.

func (*Store) WriteAspect

func (f *Store) WriteAspect(ctx context.Context, ref catalog.Ref, name catalog.AspectName, value json.RawMessage, by string) (*catalog.Change, error)

WriteAspect implements catalog.Store.

func (*Store) WriteAspects

func (f *Store) WriteAspects(_ context.Context, edits []catalog.AspectEdit, by string) ([]catalog.Change, error)

WriteAspects implements catalog.Store.

Jump to

Keyboard shortcuts

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