storage

package
v0.0.0-...-98441cc Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewProjection

func NewProjection(options ...SQLBuilderOption) (string, error)

NewProjection generates a SQL string based on the given SQLBuilderOption

Types

type DTO

type DTO struct {
	Page     int
	PageSize int
	Order    string
	// contains filtered or unexported fields
}

type DocumentDBCollection

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

func (*DocumentDBCollection) FindOne

func (m *DocumentDBCollection) FindOne(ctx context.Context, destination interface{}, query *DocumentDBQuery) error

func (*DocumentDBCollection) InsertOne

func (m *DocumentDBCollection) InsertOne(ctx context.Context, subject interface{}) (string, error)

func (*DocumentDBCollection) UpdateOne

func (m *DocumentDBCollection) UpdateOne(ctx context.Context, subject interface{}, query *DocumentDBQuery) error

type DocumentDBQuery

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

func NewDocumentDBQuery

func NewDocumentDBQuery(options ...DocumentDBQueryBuilderOption) (*DocumentDBQuery, error)

type DocumentDBQueryBuilderOption

type DocumentDBQueryBuilderOption func(b *DocumentDBQuery) error

func Field

func Field(name string, value interface{}) DocumentDBQueryBuilderOption

type DocumentPersister

type DocumentPersister interface {
	InsertOne(ctx context.Context, subject interface{}) (string, error)
	UpdateOne(ctx context.Context, subject interface{}, query *DocumentDBQuery) error
}

type DocumentQuerier

type DocumentQuerier interface {
	FindOne(ctx context.Context, destination interface{}, query *DocumentDBQuery) error
}

type DraftResultDTO

type DraftResultDTO struct {
	DTO
	ContestID   int
	ContestSlug string
	TaskID      int
	TaskSlug    string
	DraftID     int
	UserID      int
}

type DraftResultRepository

type DraftResultRepository interface {
	FindByID(entryID, datasetID int) (*model.DraftResult, error)
	FindBy(dto DraftResultDTO) ([]model.DraftResult, error)
}

func NewDraftResultRepository

func NewDraftResultRepository(db Queryer) DraftResultRepository

type EntryDTO

type EntryDTO struct {
	DTO
	ContestID   int
	ContestSlug string
	TaskID      int
	TaskSlug    string
}

type EntryRepository

type EntryRepository interface {
	FindByID(int) (*model.Entry, error)
	FindBy(EntryDTO) ([]model.Entry, error)
}

func NewEntryDraftRepository

func NewEntryDraftRepository(dbx Queryer) EntryRepository

NewEntryDraftRepository returns a EntryRepository for Entry Draft (CMS user_test) entity

func NewEntryRepository

func NewEntryRepository(dbx Queryer) EntryRepository

NewEntryDraftRepository returns a EntryRepository for Entry (CMS submittion) entity

type EntrySubmitTrxRepository

type EntrySubmitTrxRepository interface {
	FindByID(ctx context.Context, id string) (*model.EntrySubmitTrx, error)
	Save(ctx context.Context, trx *model.EntrySubmitTrx) (string, error)
}

func NewDraftSubmitTrxRepository

func NewDraftSubmitTrxRepository(db *mongo.Database) EntrySubmitTrxRepository

func NewEntrySubmitTrxRepository

func NewEntrySubmitTrxRepository(db *mongo.Database) EntrySubmitTrxRepository

type Queryer

type Queryer interface {
	Select(destination interface{}, query string, args ...interface{}) error
	Get(destination interface{}, query string, args ...interface{}) error
}

Queryer allows sqlx.DB binding

type QueueWriter

type QueueWriter interface {
	Write(ctx context.Context, payload interface{}) error
}

func NewQueueWriter

func NewQueueWriter(db *mongo.Database, queueName string) QueueWriter

type ResultDTO

type ResultDTO struct {
	DTO
	ContestID   int
	ContestSlug string
	TaskID      int
	TaskSlug    string
	EntryID     int
	UserID      int
	MaxScore    bool
}

type ResultRepository

type ResultRepository interface {
	FindByID(entryID, datasetID int) (*model.Result, error)
	FindBy(dto ResultDTO) ([]model.Result, error)
}

func NewResultRepository

func NewResultRepository(db Queryer) ResultRepository

type SQLBuilderOption

type SQLBuilderOption func(b *projectionBuilder)

SQLBuilderOption functional option wrapper for SQL builder

func From

func From(tables ...string) SQLBuilderOption

func Join

func Join(fmtExpresion string, tables ...interface{}) SQLBuilderOption

func LeftJoin

func LeftJoin(fmtExpresion string, tables ...interface{}) SQLBuilderOption

func Limit

func Limit(limit int) SQLBuilderOption

func Offset

func Offset(offset int) SQLBuilderOption

func OrderBy

func OrderBy(columns ...string) SQLBuilderOption

func Select

func Select(columns ...string) SQLBuilderOption

func Where

func Where(expression string) SQLBuilderOption

Jump to

Keyboard shortcuts

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