sql

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2024 License: MIT Imports: 8 Imported by: 0

README

go-queue-sql (github.com/antonio-alexander/go-queue-sql)

The goal of this library is a proof of concept that provides another implementation of go-queue that is neither in-memory (like finite/infinite) nor on-disk like go-durostore, but uses a database as a back-end.

I am FULLY aware that the database is NOT the best solution for this problem, but...a database scales considerably better than file systems or in-memory.

Documentation

Index

Constants

View Source
const (
	DefaultDatabaseHost  string = "localhost"
	DefaultDatabasePort  string = "3306"
	DefaultDatabaseName  string = "go_queue_sql"
	DefaultDatabaseTable string = "queue"
	DefaultDriverName    string = "mysql"
	DefaultUsername      string = "root"
	DefaultPassword      string = "mysql"
	DefaultParseTime     bool   = true
)

default configuration items

View Source
const (
	ErrUnsupportedTypef string = "unsupported type: %T\n"
)

Variables

This section is empty.

Functions

func New

func New(parameters ...interface{}) interface {
	goqueue.Owner
	goqueue.Enqueuer
	goqueue.Dequeuer
	goqueue.Peeker
	goqueue.Length
	Owner
}

Types

type Configuration

type Configuration struct {
	Hostname   string `json:"hostname"`
	Port       string `json:"port"`
	Username   string `json:"username"`
	Password   string `json:"password"`
	Database   string `json:"database"`
	Table      string `json:"table"`
	ParseTime  bool   `json:"parse_time"`
	DriverName string `json:"driver_name"`
}

Configuration provides the different items we can use to configure how we connect to the database

func (*Configuration) Default

func (c *Configuration) Default()

func (*Configuration) FromEnvs

func (c *Configuration) FromEnvs(envs map[string]string)

func (*Configuration) Validate

func (c *Configuration) Validate() error

type ErrorHandlerFx

type ErrorHandlerFx func(error)

type Owner

type Owner interface {
	SetErrorHandler(ErrorHandlerFx)
	Configure(config *Configuration) error
	Initialize() error
	Shutdown()
}

Jump to

Keyboard shortcuts

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