coredb

package
v2.8.0-nightly.20231005 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateProject

func CreateProject(ctx context.Context, tx *pachsql.Tx, project *pfs.ProjectInfo) error

CreateProject creates an entry in the core.projects table.

func DeleteProject

func DeleteProject(ctx context.Context, tx *pachsql.Tx, projectName string) error

DeleteProject deletes an entry in the core.projects table.

func GetProject

func GetProject(ctx context.Context, tx *pachsql.Tx, id ProjectID) (*pfs.ProjectInfo, error)

GetProject is like GetProjectByName, but retrieves an entry using the row id.

func GetProjectByName

func GetProjectByName(ctx context.Context, tx *pachsql.Tx, projectName string) (*pfs.ProjectInfo, error)

GetProjectByName retrieves an entry from the core.projects table by project name.

func IsErrProjectAlreadyExists

func IsErrProjectAlreadyExists(err error) bool

func UpdateProject

func UpdateProject(ctx context.Context, tx *pachsql.Tx, id ProjectID, project *pfs.ProjectInfo) error

UpdateProject overwrites an existing project entry by ID.

func UpsertProject

func UpsertProject(ctx context.Context, tx *pachsql.Tx, project *pfs.ProjectInfo) error

UpsertProject updates all fields of an existing project entry in the core.projects table by name. If 'upsert' is set to true, UpsertProject() will attempt to call CreateProject() if the entry does not exist.

Types

type ErrProjectAlreadyExists

type ErrProjectAlreadyExists struct {
	Name string
}

ErrProjectAlreadyExists is returned by CreateProject() when a project with the same name already exists in postgres.

func (ErrProjectAlreadyExists) Error

func (err ErrProjectAlreadyExists) Error() string

Error satisfies the error interface.

func (ErrProjectAlreadyExists) GRPCStatus

func (err ErrProjectAlreadyExists) GRPCStatus() *status.Status

func (ErrProjectAlreadyExists) Is

func (err ErrProjectAlreadyExists) Is(other error) bool

type ErrProjectNotFound

type ErrProjectNotFound struct {
	Name string
	ID   ProjectID
}

ErrProjectNotFound is returned by GetProject() when a project is not found in postgres.

func (ErrProjectNotFound) Error

func (err ErrProjectNotFound) Error() string

Error satisfies the error interface.

func (ErrProjectNotFound) GRPCStatus

func (err ErrProjectNotFound) GRPCStatus() *status.Status

func (ErrProjectNotFound) Is

func (err ErrProjectNotFound) Is(other error) bool

type Project

type Project struct {
	ID          ProjectID `db:"id"`
	Name        string    `db:"name"`
	Description string    `db:"description"`
	CreatedAt   time.Time `db:"created_at"`
	UpdatedAt   time.Time `db:"updated_at"`
}

func (*Project) Pb

func (project *Project) Pb() *pfs.Project

type ProjectID

type ProjectID uint64

ProjectID is the row id for a repo entry in postgres. A separate type is defined for safety so row ids must be explicitly cast for use in another table.

type ProjectIterator

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

ProjectIterator batches a page of projectRow entries. Entries can be retrieved using iter.Next().

func ListProject

func ListProject(ctx context.Context, tx *pachsql.Tx) (*ProjectIterator, error)

ListProject returns a ProjectIterator that exposes a Next() function for retrieving *pfs.ProjectInfo references.

func (*ProjectIterator) Next

func (iter *ProjectIterator) Next(ctx context.Context, dst **pfs.ProjectInfo) error

Next advances the iterator by one row. It returns a stream.EOS when there are no more entries.

Jump to

Keyboard shortcuts

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