gorm

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Validate added in v0.3.0

func Validate(gormDBName, gormConfig string) error

Validate checks a database name and config string for validity.

Types

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, gormDBName, gormConfig string) (*Client, error)

NewClient creates a new database session.

func (*Client) Close

func (c *Client) Close()

Close closes a database session.

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, k storage.Key) error

Delete deletes an entity using the storage client.

func (*Client) DeleteAllMatches

func (c *Client) DeleteAllMatches(ctx context.Context, q storage.Query) error

DeleteAllMatches deletes all entities matching a query.

func (*Client) DeleteChildrenOfApi

func (c *Client) DeleteChildrenOfApi(ctx context.Context, api names.Api) error

DeleteChildrenOfApi deletes all the children of a api.

func (*Client) DeleteChildrenOfProject

func (c *Client) DeleteChildrenOfProject(ctx context.Context, project names.Project) error

DeleteChildrenOfProject deletes all the children of a project.

func (*Client) DeleteChildrenOfSpec added in v0.2.1

func (c *Client) DeleteChildrenOfSpec(ctx context.Context, spec names.Spec) error

DeleteChildrenOfSpec deletes all the children of a spec.

func (*Client) DeleteChildrenOfVersion

func (c *Client) DeleteChildrenOfVersion(ctx context.Context, version names.Version) error

DeleteChildrenOfVersion deletes all the children of a version.

func (*Client) Get

func (c *Client) Get(ctx context.Context, k storage.Key, v interface{}) error

Get gets an entity using the storage client.

func (*Client) GetRecentSpecRevisions added in v0.3.0

func (c *Client) GetRecentSpecRevisions(ctx context.Context, offset int32, projectID, apiID, versionID string) storage.Iterator

func (*Client) IsNotFound

func (c *Client) IsNotFound(err error) bool

IsNotFound returns true if an error is due to an entity not being found.

func (*Client) NewKey

func (c *Client) NewKey(kind, name string) storage.Key

NewKey creates a new storage key.

func (*Client) NewQuery

func (c *Client) NewQuery(kind string) storage.Query

NewQuery creates a new query.

func (*Client) Put

func (c *Client) Put(ctx context.Context, k storage.Key, v interface{}) (storage.Key, error)

Put puts an entity using the storage client.

func (*Client) Run

Run runs a query using the storage client, returning an iterator.

type Iterator

type Iterator struct {
	Client *Client
	Values interface{}
	Index  int
	Cursor string
}

Iterator can be used to iterate through results of a query.

func (*Iterator) GetCursor

func (it *Iterator) GetCursor() (string, error)

GetCursor gets the cursor for the next page of results.

func (*Iterator) Next

func (it *Iterator) Next(v interface{}) (storage.Key, error)

Next gets the next value from the iterator.

type Key

type Key struct {
	Kind string
	Name string
}

Key represents a key in a storage provider

func (*Key) String

func (k *Key) String() string

type Query

type Query struct {
	Kind         string
	Offset       int
	Order        string
	Requirements []*Requirement
}

Query represents a query in a storage provider.

func (*Query) ApplyOffset added in v0.3.0

func (q *Query) ApplyOffset(offset int32) storage.Query

func (*Query) Descending added in v0.3.0

func (q *Query) Descending(field string) storage.Query

func (*Query) Require

func (q *Query) Require(name string, value interface{}) storage.Query

Require adds a filter to a query that requires a field to have a specified value.

type Requirement

type Requirement struct {
	Name  string
	Value interface{}
}

Requirement adds an equality filter to a query.

Jump to

Keyboard shortcuts

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