Documentation
¶
Overview ¶
Package storetest holds fixtures for tests that run against the controller store.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var V2MappingsDDL = []string{
`create table namespaces (
id integer primary key,
token varchar(64) not null,
name varchar(255) not null,
description text,
open boolean not null default(false),
created_at datetime not null default(current_timestamp),
updated_at datetime not null default(current_timestamp),
deleted boolean not null default(false),
constraint chk_name check (name <> '')
)`,
`create table names (
id integer primary key,
namespace_id integer not null constraint fk_names_namespaces references namespaces on delete cascade,
account_id integer not null constraint fk_names_accounts references accounts on delete cascade,
name varchar(255) not null,
reserved boolean not null default(false),
created_at datetime not null default(current_timestamp),
updated_at datetime not null default(current_timestamp),
deleted boolean not null default(false),
constraint chk_name check (name <> '')
)`,
`create unique index uk_names on names(namespace_id, name) where not deleted`,
`create table share_name_mappings (
id integer primary key,
share_id integer not null constraint fk_share_name_mappings_shares references shares on delete cascade,
name_id integer not null constraint fk_share_name_mappings_names references names on delete cascade,
created_at datetime not null default(current_timestamp),
updated_at datetime not null default(current_timestamp),
deleted boolean not null default(false)
)`,
`create unique index uk_share_name_mappings_name on share_name_mappings(name_id) where not deleted`,
`create table frontend_mappings (
id integer primary key autoincrement,
frontend_token string not null,
name string not null,
share_token string not null,
created_at datetime not null default(strftime('%Y-%m-%d %H:%M:%f', 'now')),
unique (frontend_token, name)
)`,
`create index frontend_mappings_share_token_idx on frontend_mappings (share_token)`,
}
V2MappingsDDL creates the v2 line's name and frontend mapping tables, as the v2 sqlite migrations (034_v2_0_0_namespaces.sql, 037_v2_0_0_frontend_mappings.sql) define them, in a v1-migrated sqlite store.
Functions ¶
func CreateV2Tables ¶
CreateV2Tables runs V2MappingsDDL in the transaction.
func LiveMappings ¶
LiveMappings counts the share's live name mappings and the frontend mappings carrying its token.
Types ¶
Click to show internal directories.
Click to hide internal directories.