Documentation
¶
Overview ¶
Package mocks is a generated GoMock package.
Index ¶
- Variables
- func CreateTables(ctx context.Context, conn Database, models ...any) error
- func MakeComments(ctx context.Context, sc SchemeCommenter, models ...interface{}) error
- func Wait(ctx context.Context, db driver.Pinger, checkPeriod time.Duration)
- type Bun
- func (db *Bun) Close() error
- func (db *Bun) Connect(ctx context.Context, cfg config.Database) error
- func (db *Bun) CreateState(ctx context.Context, s *State) error
- func (db *Bun) CreateTable(ctx context.Context, model any, opts ...CreateTableOption) error
- func (db *Bun) DB() *bun.DB
- func (db *Bun) DeleteState(ctx context.Context, s *State) error
- func (db *Bun) Exec(ctx context.Context, query string, args ...any) (int64, error)
- func (db *Bun) MakeColumnComment(ctx context.Context, tableName string, columnName string, comment string) error
- func (db *Bun) MakeTableComment(ctx context.Context, name string, comment string) error
- func (db *Bun) Ping(ctx context.Context) error
- func (db *Bun) Pool() *pgxpool.Pool
- func (db *Bun) State(ctx context.Context, indexName string) (*State, error)
- func (db *Bun) UpdateState(ctx context.Context, s *State) error
- func (db *Bun) WithLogger(hook bun.QueryHook)
- type CreateTableOption
- type CreateTableOptions
- type Database
- type MockSchemeCommenter
- type MockSchemeCommenterMockRecorder
- type PartitionBy
- type RangePartitionManager
- type SchemeCommenter
- type State
- type StateRepository
Constants ¶
This section is empty.
Variables ¶
var ( ErrConnectionIsNotInitialized = errors.New("connection is not initialized") ErrUnsupportedDatabaseType = errors.New("unsupported database type") )
errors
Functions ¶
func CreateTables ¶
CreateTables - creates tables by passed models. If partition tag is present table will be partitioned
func MakeComments ¶
func MakeComments(ctx context.Context, sc SchemeCommenter, models ...interface{}) error
MakeComments -
Types ¶
type Bun ¶
type Bun struct {
// contains filtered or unexported fields
}
Bun -
func (*Bun) CreateState ¶
CreateState -
func (*Bun) CreateTable ¶
CreateTable -
func (*Bun) DeleteState ¶
DeleteState -
func (*Bun) MakeColumnComment ¶
func (db *Bun) MakeColumnComment(ctx context.Context, tableName string, columnName string, comment string) error
MakeColumnComment -
func (*Bun) MakeTableComment ¶
MakeTableComment -
func (*Bun) UpdateState ¶
UpdateState -
type CreateTableOptions ¶
type CreateTableOptions struct {
// contains filtered or unexported fields
}
CreateTableOptions -
type Database ¶
type Database interface {
Connect(ctx context.Context, cfg config.Database) error
Exec(ctx context.Context, query string, args ...any) (int64, error)
CreateTable(ctx context.Context, model any, opts ...CreateTableOption) error
StateRepository
SchemeCommenter
driver.Pinger
io.Closer
}
Database -
type MockSchemeCommenter ¶
type MockSchemeCommenter struct {
// contains filtered or unexported fields
}
MockSchemeCommenter is a mock of SchemeCommenter interface.
func NewMockSchemeCommenter ¶
func NewMockSchemeCommenter(ctrl *gomock.Controller) *MockSchemeCommenter
NewMockSchemeCommenter creates a new mock instance.
func (*MockSchemeCommenter) EXPECT ¶
func (m *MockSchemeCommenter) EXPECT() *MockSchemeCommenterMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockSchemeCommenter) MakeColumnComment ¶
func (m *MockSchemeCommenter) MakeColumnComment(arg0 context.Context, arg1, arg2, arg3 string) error
MakeColumnComment mocks base method.
func (*MockSchemeCommenter) MakeTableComment ¶
func (m *MockSchemeCommenter) MakeTableComment(arg0 context.Context, arg1, arg2 string) error
MakeTableComment mocks base method.
type MockSchemeCommenterMockRecorder ¶
type MockSchemeCommenterMockRecorder struct {
// contains filtered or unexported fields
}
MockSchemeCommenterMockRecorder is the mock recorder for MockSchemeCommenter.
func (*MockSchemeCommenterMockRecorder) MakeColumnComment ¶
func (mr *MockSchemeCommenterMockRecorder) MakeColumnComment(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
MakeColumnComment indicates an expected call of MakeColumnComment.
func (*MockSchemeCommenterMockRecorder) MakeTableComment ¶
func (mr *MockSchemeCommenterMockRecorder) MakeTableComment(arg0, arg1, arg2 interface{}) *gomock.Call
MakeTableComment indicates an expected call of MakeTableComment.
type PartitionBy ¶
type PartitionBy int
PartitionBy -
const ( PartitionByMonth PartitionBy = iota + 1 PartitionByYear )
type RangePartitionManager ¶
type RangePartitionManager struct {
// contains filtered or unexported fields
}
RangePartitionManager -
func NewPartitionManager ¶
func NewPartitionManager(conn Database, by PartitionBy) RangePartitionManager
NewPartitionManager -
func (*RangePartitionManager) CreatePartition ¶
func (pm *RangePartitionManager) CreatePartition(ctx context.Context, currentTime time.Time, tableName string) error
CreatePartition -
func (*RangePartitionManager) CreatePartitions ¶
func (pm *RangePartitionManager) CreatePartitions(ctx context.Context, currentTime time.Time, tableNames ...string) error
CreatePartitions -
type SchemeCommenter ¶
type SchemeCommenter interface {
MakeTableComment(ctx context.Context, name string, comment string) error
MakeColumnComment(ctx context.Context, tableName string, columnName string, comment string) error
}
SchemeCommenter -
type State ¶
type State struct {
bun.BaseModel `bun:"dipdup_state" comment:"Indexer state table" gorm:"-" json:"-" pg:"-"`
IndexName string `bun:",pk" comment:"Index name" gorm:"primaryKey" json:"index_name" pg:",pk"`
IndexType string `comment:"Index type" json:"index_type"`
Hash string `comment:"Current hash" json:"hash"`
Timestamp time.Time `comment:"Current timestamp" json:"timestamp"`
Level uint64 `comment:"Index level" json:"level"`
UpdatedAt int `comment:"Last updated timestamp" gorm:"autoUpdateTime"`
CreatedAt int `comment:"Created timestamp" gorm:"autoCreateTime"`
// contains filtered or unexported fields
}
State -