// NewDB initializes a new KeyValueDB database connection.
NewDB initializes a new KeyValueDB database connection.
// NewDB initializes a new KeyValueDB database connection .
func NewDB(name string) (kv *KeyValueDB, err error) {
	db, err := sql.Open("sqlite3", name)
	if err != nil {
		return nil, err
	}
	_, err = db.Exec(`CREATE TABLE IF NOT EXISTS kv(
		table_name TEXT NOT NULL,
		id TEXT NOT NULL,
		val BLOB,
		PRIMARY KEY (table_name, id)
	);`)
	if err != nil {
		return nil, err
	}
	kv = &KeyValueDB{db}
	return kv, nil
}
func NewDB ( name string ) ( kv * KeyValueDB , err error ) { db , err := sql . Open ( " " , name ) if err != nil { return nil , err } _ , err = db . Exec ( `CREATE TABLE IF NOT EXISTS kv(
		table_name TEXT NOT NULL,
		id TEXT NOT NULL,
		val BLOB,
		PRIMARY KEY (table_name, id)
	);` ) if err != nil { return nil , err } kv = & KeyValueDB { db } return kv , nil }
NewDB initializes a new KeyValueDB database connection.
NewDB initializes a new KeyValueDB database connection .