storage

package
v0.6.12 Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AlreadyExists added in v0.5.6

func AlreadyExists(err error) bool

func NewGormLogger added in v0.4.2

func NewGormLogger(ctx context.Context) logger.Interface

Types

type ApiList

type ApiList struct {
	Apis  []models.Api
	Token string
}

ApiList contains a page of api resources.

type ArtifactList

type ArtifactList struct {
	Artifacts []models.Artifact
	Token     string
}

ArtifactList contains a page of artifact resources.

type Client

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

Client represents a connection to a storage provider.

func NewClient

func NewClient(ctx context.Context, driver, dsn string) (*Client, error)

NewClient creates a new database session using the provided driver and data source name. Driver must be one of [ sqlite3, postgres, cloudsqlpostgres ]. DSN format varies per database driver.

PostgreSQL DSN Reference: See "Connection Strings" at https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING SQLite DSN Reference: See "URI filename examples" at https://www.sqlite.org/c3ref/open.html

func (*Client) Close added in v0.4.2

func (c *Client) Close()

Close closes a database session.

func (*Client) CreateApi added in v0.5.4

func (c *Client) CreateApi(ctx context.Context, v *models.Api) error

func (*Client) CreateArtifact added in v0.5.6

func (c *Client) CreateArtifact(ctx context.Context, v *models.Artifact) error

func (*Client) CreateDeploymentRevision added in v0.5.6

func (c *Client) CreateDeploymentRevision(ctx context.Context, v *models.Deployment) error

func (*Client) CreateProject added in v0.5.4

func (c *Client) CreateProject(ctx context.Context, v *models.Project) error

func (*Client) CreateSpecRevision added in v0.5.6

func (c *Client) CreateSpecRevision(ctx context.Context, v *models.Spec) error

func (*Client) CreateVersion added in v0.5.4

func (c *Client) CreateVersion(ctx context.Context, v *models.Version) error

func (*Client) DatabaseName added in v0.4.2

func (c *Client) DatabaseName(ctx context.Context) string

func (*Client) DeleteApi

func (c *Client) DeleteApi(ctx context.Context, name names.Api, cascade bool) error

func (*Client) DeleteArtifact

func (c *Client) DeleteArtifact(ctx context.Context, name names.Artifact) error

func (*Client) DeleteDeployment added in v0.3.9

func (c *Client) DeleteDeployment(ctx context.Context, name names.Deployment, cascade bool) error

func (*Client) DeleteDeploymentRevision added in v0.3.9

func (c *Client) DeleteDeploymentRevision(ctx context.Context, name names.DeploymentRevision) error

func (*Client) DeleteProject

func (c *Client) DeleteProject(ctx context.Context, name names.Project, cascade bool) error

func (*Client) DeleteSpec

func (c *Client) DeleteSpec(ctx context.Context, name names.Spec, cascade bool) error

func (*Client) DeleteSpecRevision

func (c *Client) DeleteSpecRevision(ctx context.Context, name names.SpecRevision) error

func (*Client) DeleteVersion

func (c *Client) DeleteVersion(ctx context.Context, name names.Version, cascade bool) error

func (*Client) EnsureTables added in v0.4.2

func (c *Client) EnsureTables(ctx context.Context) error

EnsureTables ensures that all necessary tables exist in the database.

func (*Client) GetApi

func (c *Client) GetApi(ctx context.Context, name names.Api) (*models.Api, error)

func (*Client) GetArtifact

func (c *Client) GetArtifact(ctx context.Context, name names.Artifact, forUpdate bool) (*models.Artifact, error)

func (*Client) GetArtifactContents

func (c *Client) GetArtifactContents(ctx context.Context, name names.Artifact) (*models.Blob, error)

func (*Client) GetDeployment added in v0.3.9

func (c *Client) GetDeployment(ctx context.Context, name names.Deployment) (*models.Deployment, error)

func (*Client) GetDeploymentRevision added in v0.3.9

func (c *Client) GetDeploymentRevision(ctx context.Context, name names.DeploymentRevision) (*models.Deployment, error)

func (*Client) GetProject

func (c *Client) GetProject(ctx context.Context, name names.Project) (*models.Project, error)

func (*Client) GetSpec

func (c *Client) GetSpec(ctx context.Context, name names.Spec) (*models.Spec, error)

func (*Client) GetSpecRevision

func (c *Client) GetSpecRevision(ctx context.Context, name names.SpecRevision) (*models.Spec, error)

func (*Client) GetSpecRevisionContents

func (c *Client) GetSpecRevisionContents(ctx context.Context, name names.SpecRevision) (*models.Blob, error)

func (*Client) GetVersion

func (c *Client) GetVersion(ctx context.Context, name names.Version) (*models.Version, error)

func (*Client) ListApiArtifacts

func (c *Client) ListApiArtifacts(ctx context.Context, parent names.Api, opts PageOptions) (ArtifactList, error)

func (*Client) ListApis

func (c *Client) ListApis(ctx context.Context, parent names.Project, opts PageOptions) (ApiList, error)

func (*Client) ListDeploymentArtifacts added in v0.3.12

func (c *Client) ListDeploymentArtifacts(ctx context.Context, parent names.Deployment, opts PageOptions) (ArtifactList, error)

func (*Client) ListDeploymentRevisionArtifacts added in v0.5.7

func (c *Client) ListDeploymentRevisionArtifacts(ctx context.Context, parent names.DeploymentRevision, opts PageOptions) (ArtifactList, error)

func (*Client) ListDeploymentRevisions added in v0.3.9

func (c *Client) ListDeploymentRevisions(ctx context.Context, parent names.DeploymentRevision, opts PageOptions) (DeploymentList, error)

func (*Client) ListDeployments added in v0.3.9

func (c *Client) ListDeployments(ctx context.Context, parent names.Api, opts PageOptions) (DeploymentList, error)

func (*Client) ListProjectArtifacts

func (c *Client) ListProjectArtifacts(ctx context.Context, parent names.Project, opts PageOptions) (ArtifactList, error)

func (*Client) ListProjects

func (c *Client) ListProjects(ctx context.Context, opts PageOptions) (ProjectList, error)

func (*Client) ListSpecArtifacts

func (c *Client) ListSpecArtifacts(ctx context.Context, parent names.Spec, opts PageOptions) (ArtifactList, error)

func (*Client) ListSpecRevisionArtifacts added in v0.5.7

func (c *Client) ListSpecRevisionArtifacts(ctx context.Context, parent names.SpecRevision, opts PageOptions) (ArtifactList, error)

func (*Client) ListSpecRevisions

func (c *Client) ListSpecRevisions(ctx context.Context, parent names.SpecRevision, opts PageOptions) (SpecList, error)

func (*Client) ListSpecs

func (c *Client) ListSpecs(ctx context.Context, parent names.Version, opts PageOptions) (SpecList, error)

func (*Client) ListVersionArtifacts

func (c *Client) ListVersionArtifacts(ctx context.Context, parent names.Version, opts PageOptions) (ArtifactList, error)

func (*Client) ListVersions

func (c *Client) ListVersions(ctx context.Context, parent names.Api, opts PageOptions) (VersionList, error)

func (*Client) LockApis added in v0.5.6

func (c *Client) LockApis(ctx context.Context) *Client

func (*Client) LockArtifacts added in v0.5.6

func (c *Client) LockArtifacts(ctx context.Context) *Client

func (*Client) LockDeployments added in v0.5.6

func (c *Client) LockDeployments(ctx context.Context) *Client

func (*Client) LockProjects added in v0.5.6

func (c *Client) LockProjects(ctx context.Context) *Client

func (*Client) LockSpecs added in v0.5.6

func (c *Client) LockSpecs(ctx context.Context) *Client

func (*Client) LockVersions added in v0.5.6

func (c *Client) LockVersions(ctx context.Context) *Client

func (*Client) Migrate added in v0.4.2

func (c *Client) Migrate(ctx context.Context) error

func (*Client) RowCount added in v0.4.2

func (c *Client) RowCount(ctx context.Context, tableName string) (int64, error)

func (*Client) SaveApi

func (c *Client) SaveApi(ctx context.Context, v *models.Api) error

SaveApi will return codes.NotFound if key not found

func (*Client) SaveArtifact

func (c *Client) SaveArtifact(ctx context.Context, v *models.Artifact) error

SaveArtifact will upsert if key not found

func (*Client) SaveArtifactContents

func (c *Client) SaveArtifactContents(ctx context.Context, artifact *models.Artifact, contents []byte) error

SaveSpecRevisionContents will create a new blob for the artifact

func (*Client) SaveDeploymentRevision added in v0.3.9

func (c *Client) SaveDeploymentRevision(ctx context.Context, v *models.Deployment) error

SaveDeploymentRevision will upsert if key not found

func (*Client) SaveDeploymentRevisionTag added in v0.3.9

func (c *Client) SaveDeploymentRevisionTag(ctx context.Context, v *models.DeploymentRevisionTag) error

SaveDeploymentRevisionTag will upsert if key not found

func (*Client) SaveProject

func (c *Client) SaveProject(ctx context.Context, v *models.Project) error

SaveProject will return codes.NotFound if key not found

func (*Client) SaveSpecRevision

func (c *Client) SaveSpecRevision(ctx context.Context, v *models.Spec) error

SaveSpecRevision will upsert if key not found

func (*Client) SaveSpecRevisionContents

func (c *Client) SaveSpecRevisionContents(ctx context.Context, spec *models.Spec, contents []byte) error

SaveSpecRevisionContents will create a new blob for the spec

func (*Client) SaveSpecRevisionTag

func (c *Client) SaveSpecRevisionTag(ctx context.Context, v *models.SpecRevisionTag) error

SaveSpecRevisionTag will upsert if key not found

func (*Client) SaveVersion

func (c *Client) SaveVersion(ctx context.Context, v *models.Version) error

SaveVersion will return codes.NotFound if key not found

func (*Client) TableNames added in v0.4.2

func (c *Client) TableNames(ctx context.Context) ([]string, error)

func (*Client) Transaction added in v0.5.6

func (c *Client) Transaction(ctx context.Context, fn func(context.Context, *Client) error) error

type DeploymentList added in v0.3.9

type DeploymentList struct {
	Deployments []models.Deployment
	Token       string
}

DeploymentList contains a page of deployment resources.

type PageOptions

type PageOptions struct {
	// Size is the maximum number of resources to include in the response.
	// If unspecified, page size defaults to 50. Values above 1000 are coerced to 1000.
	Size int32
	// Filter is the filter string for this listing request, as described at https://google.aip.dev/160.
	Filter string
	// Order is the sorting order for this listing request, as described at https://google.aip.dev/132#ordering.
	Order string
	// Token is a value returned from with a previous page in a series of listing requests.
	// If specified, listing will continue from the end of the previous page. Otherwise,
	// the first page in a listing series will be returned.
	Token string
}

PageOptions contains custom arguments for listing requests.

type ProjectList

type ProjectList struct {
	Projects []models.Project
	Token    string
}

ProjectList contains a page of project resources.

type SpecList

type SpecList struct {
	Specs []models.Spec
	Token string
}

SpecList contains a page of spec resources.

type VersionList

type VersionList struct {
	Versions []models.Version
	Token    string
}

VersionList contains a page of version resources.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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