repository

package
v1.84.5 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearView

func ClearView(db *gorm.DB, truncateView, sequenceTable string) error

func CurrentSequenceToModel

func CurrentSequenceToModel(sequence *CurrentSequence) *model.View

func FailedEventToModel

func FailedEventToModel(failedEvent *FailedEvent) *view_model.FailedEvent

func PrepareBulkSave

func PrepareBulkSave(table string) func(db *gorm.DB, objects ...interface{}) error

func PrepareDeleteByKey

func PrepareDeleteByKey(table string, key ColumnKey, id interface{}) func(db *gorm.DB) error

func PrepareDeleteByKeys

func PrepareDeleteByKeys(table string, keys ...Key) func(db *gorm.DB) error

func PrepareDeleteByObject

func PrepareDeleteByObject(table string, object interface{}) func(db *gorm.DB) error

func PrepareGetByKey

func PrepareGetByKey(table string, key ColumnKey, id string) func(db *gorm.DB, res interface{}) error

func PrepareGetByQuery

func PrepareGetByQuery(table string, queries ...SearchQuery) func(db *gorm.DB, res interface{}) error

func PrepareSave

func PrepareSave(table string) func(db *gorm.DB, object interface{}) error

func PrepareSaveOnConflict

func PrepareSaveOnConflict(table string, conflictColumns, updateColumns []string) func(db *gorm.DB, object interface{}) error

func PrepareSearchQuery

func PrepareSearchQuery(table string, request SearchRequest) func(db *gorm.DB, res interface{}) (uint64, error)

func PrepareTruncate

func PrepareTruncate(table string) func(db *gorm.DB) error

func RemoveFailedEvent

func RemoveFailedEvent(db *gorm.DB, table string, failedEvent *FailedEvent) error

func SaveCurrentSequence

func SaveCurrentSequence(db *gorm.DB, table, viewName string, sequence uint64, eventTimestamp time.Time) error

func SaveFailedEvent

func SaveFailedEvent(db *gorm.DB, table string, failedEvent *FailedEvent) error

func SetQuery

func SetQuery(query *gorm.DB, key ColumnKey, value interface{}, method domain.SearchMethod) (*gorm.DB, error)

func Start

func Start(conf ViewConfig) (*sql.DB, *gorm.DB, error)

func UpdateCurrentSequence

func UpdateCurrentSequence(db *gorm.DB, table string, currentSequence *CurrentSequence) (err error)

Types

type ColumnKey

type ColumnKey interface {
	ToColumnName() string
}

type CurrentSequence

type CurrentSequence struct {
	ViewName                 string    `gorm:"column:view_name;primary_key"`
	CurrentSequence          uint64    `gorm:"column:current_sequence"`
	EventTimestamp           time.Time `gorm:"column:event_timestamp"`
	LastSuccessfulSpoolerRun time.Time `gorm:"column:last_successful_spooler_run"`
}

func AllCurrentSequences

func AllCurrentSequences(db *gorm.DB, table string) ([]*CurrentSequence, error)

func LatestSequence

func LatestSequence(db *gorm.DB, table, viewName string) (*CurrentSequence, error)

type FailedEvent

type FailedEvent struct {
	ViewName       string `gorm:"column:view_name;primary_key"`
	FailedSequence uint64 `gorm:"column:failed_sequence;primary_key"`
	FailureCount   uint64 `gorm:"column:failure_count"`
	ErrMsg         string `gorm:"column:err_msg"`
}

func AllFailedEvents

func AllFailedEvents(db *gorm.DB, table string) ([]*FailedEvent, error)

func FailedEventFromModel

func FailedEventFromModel(failedEvent *view_model.FailedEvent) *FailedEvent

func LatestFailedEvent

func LatestFailedEvent(db *gorm.DB, table, viewName string, sequence uint64) (*FailedEvent, error)

type FailedEventSearchKey

type FailedEventSearchKey int32
const (
	FailedEventKeyUndefined FailedEventSearchKey = iota
	FailedEventKeyViewName
	FailedEventKeyFailedSequence
)

type FailedEventSearchQuery

type FailedEventSearchQuery struct {
	Key    FailedEventSearchKey
	Method domain.SearchMethod
	Value  interface{}
}

func (FailedEventSearchQuery) GetKey

func (req FailedEventSearchQuery) GetKey() ColumnKey

func (FailedEventSearchQuery) GetMethod

func (req FailedEventSearchQuery) GetMethod() domain.SearchMethod

func (FailedEventSearchQuery) GetValue

func (req FailedEventSearchQuery) GetValue() interface{}

type GeneralSearchKey

type GeneralSearchKey model.GeneralSearchKey

func (GeneralSearchKey) ToColumnName

func (key GeneralSearchKey) ToColumnName() string

type GeneralSearchQuery

type GeneralSearchQuery model.GeneralSearchQuery

func (GeneralSearchQuery) GetKey

func (req GeneralSearchQuery) GetKey() ColumnKey

func (GeneralSearchQuery) GetMethod

func (req GeneralSearchQuery) GetMethod() domain.SearchMethod

func (GeneralSearchQuery) GetValue

func (req GeneralSearchQuery) GetValue() interface{}

type GeneralSearchRequest

type GeneralSearchRequest model.GeneralSearchRequest

func (GeneralSearchRequest) GetAsc

func (req GeneralSearchRequest) GetAsc() bool

func (GeneralSearchRequest) GetLimit

func (req GeneralSearchRequest) GetLimit() uint64

func (GeneralSearchRequest) GetOffset

func (req GeneralSearchRequest) GetOffset() uint64

func (GeneralSearchRequest) GetQueries

func (req GeneralSearchRequest) GetQueries() []SearchQuery

func (GeneralSearchRequest) GetSortingColumn

func (req GeneralSearchRequest) GetSortingColumn() ColumnKey

type Key

type Key struct {
	Key   ColumnKey
	Value interface{}
}

type SearchQuery

type SearchQuery interface {
	GetKey() ColumnKey
	GetMethod() domain.SearchMethod
	GetValue() interface{}
}

type SearchRequest

type SearchRequest interface {
	GetLimit() uint64
	GetOffset() uint64
	GetSortingColumn() ColumnKey
	GetAsc() bool
	GetQueries() []SearchQuery
}

type SequenceSearchKey

type SequenceSearchKey int32
const (
	SequenceSearchKeyUndefined SequenceSearchKey = iota
	SequenceSearchKeyViewName
	SequenceSearchKeyAggregateType
)

type ViewConfig

type ViewConfig struct {
	SQL *types.SQL
}

Jump to

Keyboard shortcuts

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