Documentation ¶
Index ¶
- Variables
- func NewDB(path string) (*sql.DB, error)
- type Gringotts
- func (g *Gringotts) FindItem(ctx context.Context, searchString string) ([]*Item, error)
- func (g *Gringotts) GetItemCount(ctx context.Context, owner string, itemID int) (int, error)
- func (g *Gringotts) GetItemName(ctx context.Context, id string) (string, error)
- func (g *Gringotts) UpdateItemCounts(ctx context.Context, owner string, itemCounts map[string]int) error
- func (g *Gringotts) UpdateItems(ctx context.Context, items map[string]string) error
- type Item
- type Migrator
Constants ¶
This section is empty.
Variables ¶
View Source
var Migrations = map[int][]string{
1: {
`
CREATE TABLE IF NOT EXISTS migration (
id INTEGER PRIMARY KEY NOT NULL,
updated_at timestamp DEFAULT CURRENT_TIMESTAMP,
migration_id INT NOT NULL UNIQUE
)
`,
`
INSERT INTO migration (migration_id) values(1)
`,
},
2: {
`
CREATE TABLE IF NOT EXISTS item_count (
id INTEGER PRIMARY KEY NOT NULL,
owner VARCHAR(64) NOT NULL,
item_id VARCHAR(64) NOT NULL COLLATE NOCASE,
item_count INTEGER NOT NULL DEFAULT 0,
FOREIGN KEY(item_id) REFERENCES item(id),
UNIQUE(owner, item_id)
)
`,
`
CREATE TABLE IF NOT EXISTS item (
id VARCHAR(64) PRIMARY KEY NOT NULL,
name VARCHAR(255) UNIQUE COLLATE NOCASE
)
`,
`
INSERT INTO migration (migration_id) values(2)
`,
},
}
Functions ¶
Types ¶
type Gringotts ¶
type Gringotts struct {
// contains filtered or unexported fields
}
func NewGringotts ¶
func (*Gringotts) GetItemCount ¶
func (*Gringotts) GetItemName ¶
func (*Gringotts) UpdateItemCounts ¶
Click to show internal directories.
Click to hide internal directories.