fabric8-wit: github.com/fabric8-services/fabric8-wit/query Index | Files | Directories

package query

import "github.com/fabric8-services/fabric8-wit/query"

Index

Package Files

query.go

Constants

const APIStringTypeQuery = "queries"

APIStringTypeQuery helps to avoid string literal

const QueryTableName = "queries"

QueryTableName constant that holds table name of Queries

type GormQueryRepository Uses

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

GormQueryRepository is the implementation of the storage interface for Queries.

func (*GormQueryRepository) CheckExists Uses

func (r *GormQueryRepository) CheckExists(ctx context.Context, id uuid.UUID) error

CheckExists returns nil if the given ID exists otherwise returns an error

func (*GormQueryRepository) Create Uses

func (r *GormQueryRepository) Create(ctx context.Context, q *Query) error

Create a new query

func (*GormQueryRepository) Delete Uses

func (r *GormQueryRepository) Delete(ctx context.Context, ID uuid.UUID) error

Delete deletes the query with the given id, returns NotFoundError or InternalError

func (*GormQueryRepository) List Uses

func (r *GormQueryRepository) List(ctx context.Context, spaceID uuid.UUID) ([]Query, error)

List all queries in a space

func (*GormQueryRepository) ListByCreator Uses

func (r *GormQueryRepository) ListByCreator(ctx context.Context, spaceID uuid.UUID, creatorID uuid.UUID) ([]Query, error)

ListByCreator all queries in a space by a creator

func (*GormQueryRepository) Load Uses

func (r *GormQueryRepository) Load(ctx context.Context, ID uuid.UUID, spaceID uuid.UUID) (*Query, error)

Load Query in a space

func (*GormQueryRepository) Save Uses

func (r *GormQueryRepository) Save(ctx context.Context, q Query) (*Query, error)

Save update the given query

type Query Uses

type Query struct {
    gormsupport.Lifecycle
    ID      uuid.UUID `sql:"type:uuid default uuid_generate_v4()" gorm:"primary_key"` // This is the ID PK field
    SpaceID uuid.UUID `sql:"type:uuid"`
    Creator uuid.UUID `sql:"type:uuid"`
    Title   string
    Fields  string
    Version int
}

Query describes a single Query

func (Query) GetETagData Uses

func (q Query) GetETagData() []interface{}

GetETagData returns the field values to use to generate the ETag

func (Query) GetLastModified Uses

func (q Query) GetLastModified() time.Time

GetLastModified returns the last modification time

func (Query) TableName Uses

func (q Query) TableName() string

TableName overrides the table name settings in Gorm to force a specific table name in the database.

type Repository Uses

type Repository interface {
    repository.Exister
    Create(ctx context.Context, u *Query) error
    List(ctx context.Context, spaceID uuid.UUID) ([]Query, error)
    ListByCreator(ctx context.Context, spaceID uuid.UUID, creatorID uuid.UUID) ([]Query, error)
    Load(ctx context.Context, queryID uuid.UUID, spaceID uuid.UUID) (*Query, error)
    Save(ctx context.Context, q Query) (*Query, error)
    Delete(ctx context.Context, ID uuid.UUID) error
}

Repository describes interactions with Queries.

func NewQueryRepository Uses

func NewQueryRepository(db *gorm.DB) Repository

NewQueryRepository creates a new storage type.

Directories

PathSynopsis
simplePackage query This package implements a super basic parser that takes a string, converts it to json and constructs an AndExpression of "key == value" expressions of all the fields in the json object this is just a stand-in until we have defined a proper query language

Package query imports 14 packages (graph) and is imported by 19 packages. Updated 2018-07-25. Refresh now. Tools for package owners.