database

package
v0.0.0-...-c907f33 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitDB

func InitDB()

InitDB removes existing db file and creates a new DB and table for IP

Types

type Database

type Database interface {
	SaveIp(ip *model.IP) error
	GetIp(ipAddr string) (*model.IP, error)
}

type SqliteDB

type SqliteDB struct {
}

func (*SqliteDB) GetIp

func (sqlDb *SqliteDB) GetIp(ipAddr string) (*model.IP, error)

GetIp returns a model.IP if record is stored in the database or nil if not exists

func (*SqliteDB) SaveIp

func (sqlDb *SqliteDB) SaveIp(ip *model.IP) error

SaveIp writes a model.IP to the database or updates it if already exists

Jump to

Keyboard shortcuts

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