summary refs log tree commit diff stats
path: root/storage/storage.go
blob: 33dd29fdb022625528b82d8c4a072d07028ba673 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package storage

import (
	"database/sql"
	"sync"
)

// DB holds the database connection, mutex & path.
type DB struct {
	Path string
	Mu   *sync.RWMutex
	Conn *sql.DB
}

// Init initializes the database.
func Init() *DB {
	db := DB{
		Mu: new(sync.RWMutex),
	}

	initDB(&db)
	return &db
}