database

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

This section is empty.

Types

type IDatabase

type IDatabase interface {
	CloseDB()
	InitDB(dbname string)
	AddCounter(identifer string) (int, error)
	WriteCounter(identifer string, v int) error
	ReadCounter(identifer string) (int, error)
}

func NewDBAdapter

func NewDBAdapter(dbType string, dbname string) (IDatabase, error)

type SQLite

type SQLite struct {
	DB     *sql.DB
	Dbname string
}

func (*SQLite) AddCounter

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

func (*SQLite) CloseDB

func (s *SQLite) CloseDB()

func (*SQLite) InitDB

func (s *SQLite) InitDB(dbname string)

func (*SQLite) ReadCounter

func (s *SQLite) ReadCounter(identifer string) (int, 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