repositories

package
v1.0.58 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

TODO all mutating methods should call Validate() before saving

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Conn                 *pgxpool.Pool
	PublicationListeners []PublicationListener
	DatasetListeners     []DatasetListener
	PublicationMutators  map[string]PublicationMutator
	DatasetMutators      map[string]DatasetMutator
	PublicationLoaders   []PublicationVisitor
	DatasetLoaders       []DatasetVisitor
}

type DatasetListener

type DatasetListener = func(*models.Dataset)

type DatasetMutator

type DatasetMutator = func(*models.Dataset, []string) error

type DatasetVisitor

type DatasetVisitor = func(*models.Dataset) error

type Mutation

type Mutation struct {
	Name string
	Args []string
	// Line is not always set
	Line int
}

type PublicationListener

type PublicationListener = func(*models.Publication)

type PublicationMutator

type PublicationMutator = func(*models.Publication, []string) error

type PublicationVisitor

type PublicationVisitor = func(*models.Publication) error

type Repo

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

func New

func New(c Config) (*Repo, error)

func (*Repo) AddCandidateRecord added in v1.0.56

func (r *Repo) AddCandidateRecord(ctx context.Context, rec *models.CandidateRecord) error

func (*Repo) AddPublicationDataset

func (s *Repo) AddPublicationDataset(p *models.Publication, d *models.Dataset, u *models.Person) error

func (*Repo) CountCandidateRecords added in v1.0.56

func (r *Repo) CountCandidateRecords(ctx context.Context) (int, error)

func (*Repo) DatasetHistory

func (s *Repo) DatasetHistory(id string, fn func(*models.Dataset) bool) error

func (*Repo) DatasetsAfter

func (s *Repo) DatasetsAfter(t time.Time, limit, offset int) (int, []*models.Dataset, error)

func (*Repo) DatasetsBetween

func (s *Repo) DatasetsBetween(t1, t2 time.Time, fn func(*models.Dataset) bool) error

func (*Repo) EachDataset

func (s *Repo) EachDataset(fn func(*models.Dataset) bool) error

func (*Repo) EachDatasetSnapshot

func (s *Repo) EachDatasetSnapshot(fn func(*models.Dataset) bool) error

func (*Repo) EachDatasetWithoutHandle

func (s *Repo) EachDatasetWithoutHandle(fn func(*models.Dataset) bool) error

func (*Repo) EachPublication

func (s *Repo) EachPublication(fn func(*models.Publication) bool) error

func (*Repo) EachPublicationSnapshot

func (s *Repo) EachPublicationSnapshot(fn func(*models.Publication) bool) error

func (*Repo) EachPublicationWithStatus added in v1.0.41

func (s *Repo) EachPublicationWithStatus(status string, fn func(*models.Publication) bool) error

func (*Repo) EachPublicationWithoutHandle

func (s *Repo) EachPublicationWithoutHandle(fn func(*models.Publication) bool) error

TODO add handle with a listener, then this method isn't needed anymore

func (*Repo) GetCandidateRecord added in v1.0.56

func (r *Repo) GetCandidateRecord(ctx context.Context, id string) (*models.CandidateRecord, error)

func (*Repo) GetCandidateRecordBySource added in v1.0.56

func (r *Repo) GetCandidateRecordBySource(ctx context.Context, sourceName string, sourceID string) (*models.CandidateRecord, error)

func (*Repo) GetCandidateRecords added in v1.0.56

func (r *Repo) GetCandidateRecords(ctx context.Context, start int, limit int) ([]*models.CandidateRecord, error)

func (*Repo) GetDataset

func (s *Repo) GetDataset(id string) (*models.Dataset, error)

func (*Repo) GetDatasetPublications

func (s *Repo) GetDatasetPublications(d *models.Dataset) ([]*models.Publication, error)

func (*Repo) GetDatasetSnapshotBefore added in v1.0.42

func (s *Repo) GetDatasetSnapshotBefore(id string, dateFrom time.Time) (*models.Dataset, error)

func (*Repo) GetDatasets

func (s *Repo) GetDatasets(ids []string) ([]*models.Dataset, error)

func (*Repo) GetPublication

func (s *Repo) GetPublication(id string) (*models.Publication, error)

func (*Repo) GetPublicationDatasets

func (s *Repo) GetPublicationDatasets(p *models.Publication) ([]*models.Dataset, error)

func (*Repo) GetPublicationSnapshotBefore added in v1.0.42

func (s *Repo) GetPublicationSnapshotBefore(id string, dateFrom time.Time) (*models.Publication, error)

func (*Repo) GetPublications

func (s *Repo) GetPublications(ids []string) ([]*models.Publication, error)

func (*Repo) GetVisibleDatasetPublications

func (s *Repo) GetVisibleDatasetPublications(u *models.Person, d *models.Dataset) ([]*models.Publication, error)

func (*Repo) GetVisiblePublicationDatasets

func (s *Repo) GetVisiblePublicationDatasets(u *models.Person, p *models.Publication) ([]*models.Dataset, error)

func (*Repo) ImportCandidateRecordAsPublication added in v1.0.56

func (r *Repo) ImportCandidateRecordAsPublication(ctx context.Context, id string, user *models.Person) (string, error)

func (*Repo) ImportDataset

func (s *Repo) ImportDataset(d *models.Dataset) error

func (*Repo) ImportPublication

func (s *Repo) ImportPublication(p *models.Publication) error

func (*Repo) MutateDataset

func (s *Repo) MutateDataset(id string, u *models.Person, muts ...Mutation) error

func (*Repo) MutatePublication

func (s *Repo) MutatePublication(id string, u *models.Person, muts ...Mutation) error

func (*Repo) PublicationHistory

func (s *Repo) PublicationHistory(id string, fn func(*models.Publication) bool) error

func (*Repo) PublicationsAfter

func (s *Repo) PublicationsAfter(t time.Time, limit, offset int) (int, []*models.Publication, error)

func (*Repo) PublicationsBetween

func (s *Repo) PublicationsBetween(t1, t2 time.Time, fn func(*models.Publication) bool) error

func (*Repo) PurgeAllDatasets

func (s *Repo) PurgeAllDatasets() error

func (*Repo) PurgeAllPublications

func (s *Repo) PurgeAllPublications() error

func (*Repo) PurgeDataset

func (s *Repo) PurgeDataset(id string) error

func (*Repo) PurgePublication

func (s *Repo) PurgePublication(id string) error

func (*Repo) RejectCandidateRecord added in v1.0.56

func (r *Repo) RejectCandidateRecord(ctx context.Context, id string) error

func (*Repo) RemovePublicationDataset

func (s *Repo) RemovePublicationDataset(p *models.Publication, d *models.Dataset, u *models.Person) error

func (*Repo) SaveDataset

func (s *Repo) SaveDataset(d *models.Dataset, u *models.Person) error

func (*Repo) SavePublication

func (s *Repo) SavePublication(p *models.Publication, u *models.Person) error

func (*Repo) UpdateDataset

func (s *Repo) UpdateDataset(snapshotID string, d *models.Dataset, u *models.Person) error

func (*Repo) UpdateDatasetEmbargoes

func (s *Repo) UpdateDatasetEmbargoes() (int, error)

func (*Repo) UpdatePublication

func (s *Repo) UpdatePublication(snapshotID string, p *models.Publication, u *models.Person) error

func (*Repo) UpdatePublicationEmbargoes

func (s *Repo) UpdatePublicationEmbargoes() (int, error)

func (*Repo) UpdatePublicationInPlace

func (s *Repo) UpdatePublicationInPlace(p *models.Publication) error

Jump to

Keyboard shortcuts

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