database

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const ADD_COUNTER = `UPDATE counters
SET count = count + 1
WHERE identifier = ?;
`
View Source
const CREATE_TABLE = `` /* 186-byte string literal not displayed */

Variables

This section is empty.

Functions

This section is empty.

Types

type IDatabase

type IDatabase interface {
	CloseDB()
	InitDB()
	AddCounter(identifer string) (int, error)
	WriteCounter(identifer string, v int) error
	GetCounter(identifer string) (int, error)
	QueryCounter(skip int, limit int) ([]common.Counter, error)
}

func NewDBAdapter

func NewDBAdapter(dbType string, dbcfg *common.DBConfig) (IDatabase, error)

type SQLite

type SQLite struct {
	DB    *sql.DB
	DBCfg *common.DBConfig
}

func (*SQLite) AddCounter

func (s *SQLite) AddCounter(identifer string) (int, error)

func (*SQLite) CloseDB

func (s *SQLite) CloseDB()

func (*SQLite) Exec added in v0.0.2

func (s *SQLite) Exec(st string) error

func (*SQLite) GetCounter added in v0.0.2

func (s *SQLite) GetCounter(identifer string) (int, error)

func (*SQLite) InitDB

func (s *SQLite) InitDB()

func (*SQLite) QueryCounter added in v0.0.2

func (s *SQLite) QueryCounter(skip int, limit int) ([]common.Counter, error)

func (*SQLite) WriteCounter

func (s *SQLite) WriteCounter(identifer string, v int) error

Jump to

Keyboard shortcuts

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