database

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRedisClient

func NewRedisClient(host string, port int) (*redis.Client, error)

Types

type Database

type Database interface {
	UpdateJobExecutions(ctx context.Context) (int, error)
	RemoveFromUriQueue(ctx context.Context) (int, error)
	MoveWaitToReady() (int, error)
	MoveBusyToTimeout() (int, error)
	MoveRunningToTimeout() (int, error)
	TimeoutCrawlExecutions(ctx context.Context) (int, error)
}

Database is an abstraction layer between the business layer and database implementation details

func NewDatabase

func NewDatabase(redisClient *redis.Client, conn *RethinkDbConnection, scriptPath string) (Database, error)

type RethinkDbConnection

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

RethinkDbConnection holds the database connection

func NewRethinkDbConnection

func NewRethinkDbConnection(opts RethinkDbOptions) *RethinkDbConnection

NewRethinkDbConnection creates a new RethinkDbConnection object

func (*RethinkDbConnection) Close

func (c *RethinkDbConnection) Close() error

Close closes the RethinkDbConnection

func (*RethinkDbConnection) Connect

func (c *RethinkDbConnection) Connect() error

Connect establishes connections

type RethinkDbMockConnection

type RethinkDbMockConnection struct {
	*RethinkDbConnection
}

func NewMockConnection

func NewMockConnection() *RethinkDbMockConnection

NewMockConnection creates a new mocked RethinkDbConnection object

func (*RethinkDbMockConnection) Close

func (c *RethinkDbMockConnection) Close() error

func (*RethinkDbMockConnection) GetMock

func (c *RethinkDbMockConnection) GetMock() *r.Mock

type RethinkDbOptions

type RethinkDbOptions struct {
	Username           string
	Password           string
	Database           string
	UseOpenTracing     bool
	Address            string
	QueryTimeout       time.Duration
	MaxRetries         int
	MaxOpenConnections int
}

Jump to

Keyboard shortcuts

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