db

package
v0.0.0-...-317f090 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: MIT Imports: 18 Imported by: 2

README

DataBase drivers

This package contains the database drivers for use in ShortLink services.

URI format

We use the following format for the database URI:

URI FORMAT

Graceful shutdown

Safely terminate database interactions by closing the associated Context:

ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
// Utilize ctx in your database tasks

Documentation

Overview

Data Base package

Index

Constants

This section is empty.

Variables

View Source
var ErrGetConnection = errors.New("error get connection")

Functions

This section is empty.

Types

type DB

type DB interface {
	Init(ctx context.Context) error
	GetConn() any
}

DB - common interface of db

type Store

type Store struct {
	DB
	// contains filtered or unexported fields
}

Store abstract type

func New

func New(ctx context.Context, log logger.Logger, tracer trace.TracerProvider, metrics *metric.MeterProvider) (*Store, error)

New - return implementation of db

type UnknownStoreTypeError

type UnknownStoreTypeError struct {
	StoreType string
}

UnknownStoreTypeError - unknown store type error

func (UnknownStoreTypeError) Error

func (e UnknownStoreTypeError) Error() string

Jump to

Keyboard shortcuts

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