Documentation
¶
Overview ¶
internal/db/queries_masquerade.go
Index ¶
- Variables
- type Adventure
- type CalendarEvent
- type Campaign
- type CampaignCalendarInfo
- type CampaignStats
- type Character
- type CombatEncounter
- type Combatant
- type DB
- func (d *DB) AddCombatant(encounterID int64, name string, initiative, hpMax int, isPlayer bool, ...) (int64, error)
- func (d *DB) AddMapPin(mapID int64, x, y float64, label, note, color string) (int64, error)
- func (d *DB) AdvanceTurn(encounterID int64) (nextIdx int, roundNumber int, err error)
- func (d *DB) Close() error
- func (d *DB) CloseCampaign(id int64) error
- func (d *DB) CreateAdventure(campaignID int64, title, description, status string, sortOrder int) (int64, error)
- func (db *DB) CreateCalendarEvent(campaignID int64, year, month, day int, title, description, eventType string, ...) (int64, error)
- func (d *DB) CreateCampaign(rulesetID int64, name, description string) (int64, error)
- func (d *DB) CreateCharacter(campaignID int64, name string) (int64, error)
- func (d *DB) CreateDeck(campaignID int64, name, cardsJSON string) (int64, error)
- func (d *DB) CreateEncounter(sessionID int64, name string) (int64, error)
- func (db *DB) CreateFaction(campaignID int64, name, description, factionType string, influence int, ...) (int64, error)
- func (d *DB) CreateItem(characterID int64, name, description string, quantity int) (*Item, error)
- func (d *DB) CreateMacro(characterID int64, label, actionText, color string) (int64, error)
- func (d *DB) CreateMap(campaignID int64, name, imagePath string) (int64, error)
- func (d *DB) CreateMapZone(mapID int64, name string, x, y, w, h float64) (int64, error)
- func (d *DB) CreateMessage(sessionID int64, role, content string, whisper bool, characterID *int64) (int64, error)
- func (d *DB) CreateNpcStat(campaignID int64, name, role, dataJSON string, hpMax int, armorClass *int, ...) (int64, error)
- func (d *DB) CreateObjective(campaignID int64, title, description string, parentID *int64) (*Objective, error)
- func (db *DB) CreateRelationship(campaignID int64, fromName, toName, relType, description string) (int64, error)
- func (d *DB) CreateRulebookChunks(rulesetID int64, chunks []RulebookChunk) error
- func (d *DB) CreateRuleset(name, schemaJSON, version string) (int64, error)
- func (db *DB) CreateSecret(campaignID int64, title, content, category string) (int64, error)
- func (d *DB) CreateSession(campaignID int64, title, date string) (int64, error)
- func (d *DB) CreateSessionNPC(sessionID int64, name, note string) (SessionNPC, error)
- func (d *DB) CreateWorldNote(campaignID int64, title, content, category string) (int64, error)
- func (d *DB) CreateXP(sessionID int64, note string, amount *int) (*XPEntry, error)
- func (d *DB) DeduplicateObjectives(campaignID int64) (int, error)
- func (d *DB) DeleteAdventure(id int64) error
- func (db *DB) DeleteCalendarEvent(id int64) error
- func (d *DB) DeleteCampaign(id int64) error
- func (d *DB) DeleteCharacter(id int64) error
- func (d *DB) DeleteDeck(id int64) error
- func (db *DB) DeleteFaction(id int64) error
- func (d *DB) DeleteItem(id int64) error
- func (d *DB) DeleteMacro(id int64) error
- func (d *DB) DeleteMapZone(id int64) error
- func (d *DB) DeleteNpcStat(id int64) error
- func (d *DB) DeleteObjective(id int64) error
- func (db *DB) DeleteRelationship(id int64) error
- func (d *DB) DeleteRulebookChunks(rulesetID int64) error
- func (d *DB) DeleteRulebookChunksBySource(rulesetID int64, source string) error
- func (db *DB) DeleteSecret(id int64) error
- func (d *DB) DeleteSession(id int64) error
- func (d *DB) DeleteSessionNPC(id int64) error
- func (d *DB) DeleteXP(id int64) error
- func (d *DB) DrawCard(deckID int64, expectedDrawIndex, newDrawIndex int, sessionID int64, ...) error
- func (d *DB) EndEncounter(id int64) error
- func (d *DB) FindWorldNoteByTitle(campaignID int64, title string) (*WorldNote, error)
- func (d *DB) GetActiveEncounter(sessionID int64) (*CombatEncounter, error)
- func (d *DB) GetAdventure(id int64) (*Adventure, error)
- func (db *DB) GetCalendarEvent(id int64) (*CalendarEvent, error)
- func (d *DB) GetCampaign(id int64) (*Campaign, error)
- func (db *DB) GetCampaignDate(campaignID int64) (*CampaignCalendarInfo, error)
- func (d *DB) GetCampaignStats(id int64) (CampaignStats, error)
- func (d *DB) GetCharacter(id int64) (*Character, error)
- func (d *DB) GetDeck(id int64) (*Deck, error)
- func (db *DB) GetFaction(id int64) (*Faction, error)
- func (d *DB) GetItem(id int64) (*Item, error)
- func (d *DB) GetLatestMap(campaignID int64) (*Map, error)
- func (d *DB) GetMap(id int64) (*Map, error)
- func (d *DB) GetMapZone(id int64) (*MapZone, error)
- func (db *DB) GetMasqueradeIntegrity(sessionID int64) (int, error)
- func (d *DB) GetNpcStat(id int64) (*NpcStat, error)
- func (d *DB) GetObjective(id int64) (*Objective, error)
- func (db *DB) GetRelationship(id int64) (*Relationship, error)
- func (d *DB) GetRuleset(id int64) (*Ruleset, error)
- func (d *DB) GetRulesetByName(name string) (*Ruleset, error)
- func (db *DB) GetSecret(id int64) (*Secret, error)
- func (d *DB) GetSession(id int64) (*Session, error)
- func (d *DB) GetSessionNPC(id int64) (*SessionNPC, error)
- func (d *DB) GetSessionTimeline(sessionID int64) ([]TimelineEntry, error)
- func (d *DB) GetSetting(key string) (string, error)
- func (db *DB) GetTension(sessionID int64) (int, error)
- func (d *DB) GetToken(id int64) (*MapToken, error)
- func (d *DB) GetWorldNote(id int64) (*WorldNote, error)
- func (d *DB) ListAIVisibleMessages(sessionID int64) ([]Message, error)
- func (d *DB) ListAdventures(campaignID int64) ([]Adventure, error)
- func (d *DB) ListAllChunks(rulesetID int64) ([]RulebookChunk, error)
- func (db *DB) ListCalendarEvents(campaignID int64) ([]CalendarEvent, error)
- func (d *DB) ListCampaigns() ([]Campaign, error)
- func (d *DB) ListCharacters(campaignID int64) ([]Character, error)
- func (d *DB) ListChunksForEmbedding(rulesetID int64) ([]RulebookChunk, error)
- func (d *DB) ListCombatants(encounterID int64) ([]Combatant, error)
- func (d *DB) ListDeckDraws(sessionID int64) ([]DeckDraw, error)
- func (d *DB) ListDecks(campaignID int64) ([]Deck, error)
- func (d *DB) ListDiceRolls(sessionID int64) ([]DiceRoll, error)
- func (db *DB) ListFactions(campaignID int64) ([]Faction, error)
- func (d *DB) ListItems(characterID int64) ([]Item, error)
- func (d *DB) ListMacros(characterID int64) ([]Macro, error)
- func (d *DB) ListMapPins(mapID int64) ([]MapPin, error)
- func (d *DB) ListMapTokens(mapID int64) ([]MapToken, error)
- func (d *DB) ListMapZones(mapID int64) ([]MapZone, error)
- func (d *DB) ListMaps(campaignID int64) ([]Map, error)
- func (d *DB) ListMessages(sessionID int64) ([]Message, error)
- func (d *DB) ListNpcStats(campaignID int64) ([]NpcStat, error)
- func (d *DB) ListObjectives(campaignID int64) ([]Objective, error)
- func (d *DB) ListRecentWorldNotes(campaignID int64, limit int) ([]WorldNote, error)
- func (db *DB) ListRelationships(campaignID int64) ([]Relationship, error)
- func (d *DB) ListRulebookSources(rulesetID int64) ([]RulebookSource, error)
- func (d *DB) ListRulesets() ([]Ruleset, error)
- func (db *DB) ListSecretsByCampaign(campaignID int64) ([]Secret, error)
- func (d *DB) ListSessionNPCs(sessionID int64) ([]SessionNPC, error)
- func (d *DB) ListSessions(campaignID int64) ([]Session, error)
- func (d *DB) ListSessionsByAdventure(adventureID int64) ([]Session, error)
- func (d *DB) ListUnrevealedZones(mapID int64) ([]MapZone, error)
- func (d *DB) ListXP(sessionID int64) ([]XPEntry, error)
- func (d *DB) LogDiceRoll(sessionID int64, expression string, result int, breakdownJSON string) (int64, error)
- func (d *DB) MoveToken(id int64, x, y float64) error
- func (d *DB) PatchCombatantInitiative(id int64, initiative int) error
- func (d *DB) PatchWorldNoteRevealed(id int64, revealed bool) error
- func (d *DB) PlaceToken(mapID int64, entityType string, entityID int64, x, y float64) (int64, error)
- func (d *DB) RecentMessages(sessionID int64, limit int) ([]Message, error)
- func (d *DB) RemoveToken(id int64) error
- func (d *DB) ReopenCampaign(id int64) error
- func (d *DB) ReorderCombatants(encounterID int64, ids []int64) error
- func (d *DB) ReorderMacros(characterID int64, ids []int64) error
- func (db *DB) RevealSecret(id int64, sessionID int64) error
- func (d *DB) RevealZone(id int64, revealed bool) error
- func (d *DB) RollOracle(rulesetID *int64, tableName string, roll int) (string, error)
- func (d *DB) SQL() *sql.DB
- func (d *DB) SearchRulebookChunks(rulesetID int64, query string) ([]RulebookChunk, error)
- func (d *DB) SearchWorldNotes(campaignID int64, query, category, tag string, revealed *bool) ([]WorldNote, error)
- func (d *DB) SetCampaignChronicleNightStartDOW(id int64, dow int) error
- func (d *DB) SetSessionAdventure(sessionID int64, adventureID *int64) error
- func (d *DB) SetSetting(key, value string) error
- func (d *DB) ShuffleDeck(id int64, shuffledOrderJSON string) error
- func (d *DB) UpdateAdventure(id int64, title, description, status string, sortOrder int) error
- func (d *DB) UpdateCampaignChronicleNight(id int64, night int) error
- func (d *DB) UpdateCampaignConfig(id int64, ...) error
- func (db *DB) UpdateCampaignDate(campaignID int64, year, month, day int, calendarConfig *string) error
- func (d *DB) UpdateCharacterCurrencyBalance(id int64, balance int64) error
- func (d *DB) UpdateCharacterCurrencyLabel(id int64, label string) error
- func (d *DB) UpdateCharacterData(id int64, dataJSON string) error
- func (d *DB) UpdateCharacterPortrait(id int64, portraitPath string) error
- func (d *DB) UpdateCombatant(id int64, hpCurrent int, conditionsJSON string) error
- func (d *DB) UpdateCombatantVtMDamage(id int64, superficialIn, aggravatedIn int, isVampire bool) error
- func (db *DB) UpdateFaction(id int64, name, description, factionType string, influence int, ...) error
- func (d *DB) UpdateItem(id int64, name, description string, quantity int, equipped bool) error
- func (d *DB) UpdateMacro(id int64, label, actionText, color string) error
- func (d *DB) UpdateMapZone(id int64, name string, x, y, w, h float64) error
- func (db *DB) UpdateMasqueradeIntegrity(sessionID int64, level int) error
- func (d *DB) UpdateNpcStats(id int64, name, role, dataJSON string, hpMax int, armorClass *int, ...) error
- func (d *DB) UpdateObjectiveStatus(id int64, status string) error
- func (db *DB) UpdateRelationship(id int64, relType, description string) error
- func (d *DB) UpdateSceneTags(sessionID int64, tags string) error
- func (db *DB) UpdateSecret(id int64, title, content, category string) error
- func (d *DB) UpdateSessionNPC(id int64, note string) error
- func (d *DB) UpdateSessionNotes(id int64, notes string) error
- func (d *DB) UpdateSessionSummary(id int64, summary string) error
- func (db *DB) UpdateTension(sessionID int64, level int) error
- func (d *DB) UpdateWorldNote(id int64, title, content, tagsJSON string) error
- func (d *DB) UpdateWorldNotePersonality(noteID int64, personalityJSON string) error
- func (d *DB) UpsertChunkEmbedding(id int64, emb []float32) error
- type Deck
- type DeckDraw
- type DiceRoll
- type Faction
- type Item
- type Macro
- type Map
- type MapPin
- type MapToken
- type MapZone
- type Message
- type NpcStat
- type Objective
- type OpenOptions
- type Relationship
- type RulebookChunk
- type RulebookSource
- type Ruleset
- type Secret
- type Session
- type SessionNPC
- type TimelineEntry
- type WorldNote
- type XPEntry
Constants ¶
This section is empty.
Variables ¶
var ErrDrawConflict = errors.New("draw conflict: another draw completed first")
Functions ¶
This section is empty.
Types ¶
type Adventure ¶
type Adventure struct {
ID int64 `json:"id"`
CampaignID int64 `json:"campaign_id"`
Title string `json:"title"`
Description string `json:"description"`
Status string `json:"status"`
SortOrder int `json:"sort_order"`
CreatedAt string `json:"created_at"`
}
Adventure represents a story arc/chapter within a campaign.
type CalendarEvent ¶
type CalendarEvent struct {
ID int64 `json:"id"`
CampaignID int64 `json:"campaign_id"`
InGameYear int `json:"in_game_year"`
InGameMonth int `json:"in_game_month"`
InGameDay int `json:"in_game_day"`
Title string `json:"title"`
Description string `json:"description"`
EventType string `json:"event_type"`
SessionID *int64 `json:"session_id"`
CreatedAt string `json:"created_at"`
}
type Campaign ¶
type Campaign struct {
ID int64 `json:"id"`
RulesetID int64 `json:"ruleset_id"`
Name string `json:"name"`
Description string `json:"description"`
Active bool `json:"active"`
ChronicleNight int `json:"chronicle_night"`
ChronicleNightStartDOW int `json:"chronicle_night_start_dow"`
GmNotes string `json:"gm_notes"`
SystemPromptOverride string `json:"system_prompt_override"`
ContentBoundaries string `json:"content_boundaries"`
NarrativeLocale string `json:"narrative_locale"`
CreatedAt string `json:"created_at"`
}
type CampaignCalendarInfo ¶
type CampaignCalendarInfo struct {
InGameYear int `json:"in_game_year"`
InGameMonth int `json:"in_game_month"`
InGameDay int `json:"in_game_day"`
CalendarConfig string `json:"calendar_config"`
}
CampaignCalendarInfo holds the calendar state for a campaign.
type CampaignStats ¶
CampaignStats holds row counts for the confirmation message in delete_campaign.
type Character ¶
type Character struct {
ID int64 `json:"id"`
CampaignID int64 `json:"campaign_id"`
Name string `json:"name"`
DataJSON string `json:"data_json"`
PortraitPath string `json:"portrait_path"` // NOT NULL DEFAULT ” in schema; never nil
CurrencyBalance int64 `json:"currency_balance"`
CurrencyLabel string `json:"currency_label"`
CreatedAt string `json:"created_at"`
}
type CombatEncounter ¶
type Combatant ¶
type Combatant struct {
ID int64 `json:"id"`
EncounterID int64 `json:"encounter_id"`
CharacterID *int64 `json:"character_id"`
Name string `json:"name"`
Initiative int `json:"initiative"`
HPCurrent int `json:"hp_current"`
HPMax int `json:"hp_max"`
ConditionsJSON string `json:"conditions_json"`
IsPlayer bool `json:"is_player"`
DamageSuperficial int `json:"damage_superficial"`
DamageAggravated int `json:"damage_aggravated"`
WillpowerSuperficial int `json:"willpower_superficial"`
WillpowerAggravated int `json:"willpower_aggravated"`
Hunger int `json:"hunger"`
SortOrder int `json:"sort_order"`
}
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB wraps sql.DB with typed query methods.
func Open ¶
Open opens (or creates) the SQLite database at path and runs pending migrations. Creates parent directories if they do not exist.
func OpenWithOptions ¶
func OpenWithOptions(path string, opts OpenOptions) (*DB, error)
OpenWithOptions opens (or creates) the SQLite database at path, validates it, runs pending migrations, and rejects any remaining foreign-key violations.
func (*DB) AddCombatant ¶
func (*DB) AdvanceTurn ¶
AdvanceTurn advances active_turn_index, increments round_number on wrap, and decays timed conditions on the newly-active combatant. Returns the new index and the current round number.
func (*DB) CloseCampaign ¶
CloseCampaign sets active = 0 for the given campaign. Returns an error if the campaign does not exist. Idempotent: closing an already-closed campaign is a no-op.
func (*DB) CreateAdventure ¶
func (d *DB) CreateAdventure(campaignID int64, title, description, status string, sortOrder int) (int64, error)
CreateAdventure inserts a new adventure and returns its ID.
func (*DB) CreateCalendarEvent ¶
func (db *DB) CreateCalendarEvent(campaignID int64, year, month, day int, title, description, eventType string, sessionID *int64) (int64, error)
CreateCalendarEvent inserts a new calendar event.
func (*DB) CreateCampaign ¶
func (*DB) CreateCharacter ¶
func (*DB) CreateDeck ¶
func (*DB) CreateEncounter ¶
func (*DB) CreateFaction ¶
func (db *DB) CreateFaction(campaignID int64, name, description, factionType string, influence int, resourcesJSON, color string) (int64, error)
CreateFaction inserts a new faction and returns its ID.
func (*DB) CreateItem ¶
CreateItem inserts a new item and returns it.
func (*DB) CreateMacro ¶
func (*DB) CreateMapZone ¶
func (*DB) CreateMessage ¶
func (*DB) CreateNpcStat ¶
func (d *DB) CreateNpcStat(campaignID int64, name, role, dataJSON string, hpMax int, armorClass *int, initiativeMod int, skills, abilities, loot, notes string) (int64, error)
CreateNpcStat inserts a new NPC stat block and returns its ID.
func (*DB) CreateObjective ¶
func (d *DB) CreateObjective(campaignID int64, title, description string, parentID *int64) (*Objective, error)
CreateObjective inserts a new objective and returns it. parentID may be nil for top-level objectives.
func (*DB) CreateRelationship ¶
func (db *DB) CreateRelationship(campaignID int64, fromName, toName, relType, description string) (int64, error)
CreateRelationship inserts a new relationship and returns its ID.
func (*DB) CreateRulebookChunks ¶
func (d *DB) CreateRulebookChunks(rulesetID int64, chunks []RulebookChunk) error
CreateRulebookChunks inserts multiple chunks for a ruleset in a single transaction.
func (*DB) CreateRuleset ¶
func (*DB) CreateSecret ¶
func (*DB) CreateSession ¶
func (*DB) CreateSessionNPC ¶
func (d *DB) CreateSessionNPC(sessionID int64, name, note string) (SessionNPC, error)
func (*DB) CreateWorldNote ¶
func (*DB) DeduplicateObjectives ¶
DeduplicateObjectives removes duplicate objectives within a campaign, keeping the oldest copy of each title (lowest id). Returns the number deleted.
func (*DB) DeleteAdventure ¶
DeleteAdventure removes an adventure by ID.
func (*DB) DeleteCalendarEvent ¶
DeleteCalendarEvent removes a calendar event by ID.
func (*DB) DeleteCampaign ¶
func (*DB) DeleteCharacter ¶
DeleteCharacter removes a character. Declared foreign-key actions cascade owned rows and clear optional references atomically with the parent delete.
func (*DB) DeleteDeck ¶
func (*DB) DeleteFaction ¶
DeleteFaction removes a faction by ID.
func (*DB) DeleteMacro ¶
func (*DB) DeleteMapZone ¶
func (*DB) DeleteNpcStat ¶
DeleteNpcStat removes an NPC stat block by ID.
func (*DB) DeleteObjective ¶
DeleteObjective removes an objective. Its descendants are owned rows and cascade through the declared self-referential foreign key.
func (*DB) DeleteRelationship ¶
DeleteRelationship removes a relationship by ID.
func (*DB) DeleteRulebookChunks ¶
DeleteRulebookChunks removes all chunks for a ruleset.
func (*DB) DeleteRulebookChunksBySource ¶
DeleteRulebookChunksBySource removes chunks for a specific source book within a ruleset.
func (*DB) DeleteSecret ¶
func (*DB) DeleteSession ¶
func (*DB) DeleteSessionNPC ¶
func (*DB) EndEncounter ¶
func (*DB) FindWorldNoteByTitle ¶
func (*DB) GetActiveEncounter ¶
func (d *DB) GetActiveEncounter(sessionID int64) (*CombatEncounter, error)
func (*DB) GetAdventure ¶
GetAdventure returns a single adventure by ID.
func (*DB) GetCalendarEvent ¶
func (db *DB) GetCalendarEvent(id int64) (*CalendarEvent, error)
GetCalendarEvent returns a single calendar event by ID.
func (*DB) GetCampaignDate ¶
func (db *DB) GetCampaignDate(campaignID int64) (*CampaignCalendarInfo, error)
GetCampaignDate returns the current in-game date and calendar config for a campaign.
func (*DB) GetCampaignStats ¶
func (d *DB) GetCampaignStats(id int64) (CampaignStats, error)
func (*DB) GetFaction ¶
GetFaction returns a single faction by ID.
func (*DB) GetMasqueradeIntegrity ¶
GetMasqueradeIntegrity returns the Masquerade integrity (0-10) for a session. Default is 10 (full Masquerade intact).
func (*DB) GetNpcStat ¶
GetNpcStat returns a single NPC stat block by ID.
func (*DB) GetObjective ¶
GetObjective returns a single objective by ID, or nil if not found.
func (*DB) GetRelationship ¶
func (db *DB) GetRelationship(id int64) (*Relationship, error)
func (*DB) GetRuleset ¶
GetRuleset returns a single ruleset by ID.
func (*DB) GetSessionNPC ¶
func (d *DB) GetSessionNPC(id int64) (*SessionNPC, error)
func (*DB) GetSessionTimeline ¶
func (d *DB) GetSessionTimeline(sessionID int64) ([]TimelineEntry, error)
GetSessionTimeline returns all messages and dice rolls for the given session, merged and sorted by created_at ascending.
func (*DB) GetTension ¶
GetTension returns the tension level (1-10) for a session.
func (*DB) ListAIVisibleMessages ¶
ListAIVisibleMessages returns the session transcript that may be shared with an AI provider. Whispers are excluded by the database query so callers cannot accidentally include private content while building context.
func (*DB) ListAdventures ¶
ListAdventures returns all adventures for a campaign, ordered by sort_order.
func (*DB) ListAllChunks ¶
func (d *DB) ListAllChunks(rulesetID int64) ([]RulebookChunk, error)
ListAllChunks returns all chunks for a ruleset, including those with embeddings.
func (*DB) ListCalendarEvents ¶
func (db *DB) ListCalendarEvents(campaignID int64) ([]CalendarEvent, error)
ListCalendarEvents returns all calendar events for a campaign, ordered by date.
func (*DB) ListCampaigns ¶
func (*DB) ListChunksForEmbedding ¶
func (d *DB) ListChunksForEmbedding(rulesetID int64) ([]RulebookChunk, error)
ListChunksForEmbedding returns chunks that have no embedding yet for a given ruleset.
func (*DB) ListFactions ¶
ListFactions returns all factions for a campaign.
func (*DB) ListNpcStats ¶
ListNpcStats returns all NPC stat blocks for a campaign.
func (*DB) ListObjectives ¶
ListObjectives returns all objectives for a campaign, ordered by created_at DESC.
func (*DB) ListRecentWorldNotes ¶
ListRecentWorldNotes returns the most recent n world notes for a campaign, ordered by created_at DESC.
func (*DB) ListRelationships ¶
func (db *DB) ListRelationships(campaignID int64) ([]Relationship, error)
ListRelationships returns all relationships for a campaign.
func (*DB) ListRulebookSources ¶
func (d *DB) ListRulebookSources(rulesetID int64) ([]RulebookSource, error)
ListRulebookSources returns each distinct source uploaded for a ruleset with its chunk count.
func (*DB) ListRulesets ¶
func (*DB) ListSecretsByCampaign ¶
func (*DB) ListSessionNPCs ¶
func (d *DB) ListSessionNPCs(sessionID int64) ([]SessionNPC, error)
func (*DB) ListSessionsByAdventure ¶
ListSessionsByAdventure returns sessions for a given adventure.
func (*DB) LogDiceRoll ¶
func (*DB) PatchCombatantInitiative ¶
func (*DB) PatchWorldNoteRevealed ¶
func (*DB) PlaceToken ¶
func (*DB) RecentMessages ¶
func (*DB) RemoveToken ¶
func (*DB) ReopenCampaign ¶
ReopenCampaign sets active = 1 for the given campaign. Returns an error if the campaign does not exist. Idempotent: reopening an already-open campaign is a no-op.
func (*DB) RollOracle ¶
RollOracle looks up an oracle table result for the given roll value. If rulesetID is provided, it first tries ruleset-specific rows, then falls back to generic (ruleset_id IS NULL). Returns empty string (no error) if no matching row is found.
func (*DB) SearchRulebookChunks ¶
func (d *DB) SearchRulebookChunks(rulesetID int64, query string) ([]RulebookChunk, error)
SearchRulebookChunks returns up to 5 chunks matching query in heading or content (LIKE search).
func (*DB) SearchWorldNotes ¶
func (*DB) SetCampaignChronicleNightStartDOW ¶
func (*DB) SetSessionAdventure ¶
SetSessionAdventure updates the adventure_id for a session. Pass nil to remove the session from an adventure.
func (*DB) SetSetting ¶
func (*DB) UpdateAdventure ¶
UpdateAdventure updates an existing adventure's fields.
func (*DB) UpdateCampaignChronicleNight ¶
func (*DB) UpdateCampaignConfig ¶
func (d *DB) UpdateCampaignConfig(id int64, description, gmNotes, systemPromptOverride, contentBoundaries, narrativeLocale *string) error
UpdateCampaignConfig updates the configurable text fields of a campaign. Only non-nil values are applied. Returns an error if the campaign does not exist.
func (*DB) UpdateCampaignDate ¶
func (db *DB) UpdateCampaignDate(campaignID int64, year, month, day int, calendarConfig *string) error
UpdateCampaignDate sets the in-game date and optional calendar config for a campaign.
func (*DB) UpdateCharacterCurrencyBalance ¶
func (*DB) UpdateCharacterCurrencyLabel ¶
func (*DB) UpdateCharacterPortrait ¶
func (*DB) UpdateCombatant ¶
func (*DB) UpdateCombatantVtMDamage ¶
func (d *DB) UpdateCombatantVtMDamage(id int64, superficialIn, aggravatedIn int, isVampire bool) error
UpdateCombatantVtMDamage applies VtM V5 damage to a combatant. isVampire=true halves superficial damage (round up). Superficial overflow beyond HPMax converts to aggravated.
func (*DB) UpdateFaction ¶
func (db *DB) UpdateFaction(id int64, name, description, factionType string, influence int, resourcesJSON, color string) error
UpdateFaction updates an existing faction's fields.
func (*DB) UpdateItem ¶
UpdateItem patches mutable fields (name, description, quantity, equipped).
func (*DB) UpdateMapZone ¶
func (*DB) UpdateMasqueradeIntegrity ¶
UpdateMasqueradeIntegrity sets the Masquerade integrity for a session, clamping to [0, 10].
func (*DB) UpdateNpcStats ¶
func (d *DB) UpdateNpcStats(id int64, name, role, dataJSON string, hpMax int, armorClass *int, initiativeMod int, skills, abilities, loot, notes string) error
UpdateNpcStats updates an existing NPC stat block's fields.
func (*DB) UpdateObjectiveStatus ¶
UpdateObjectiveStatus sets the status for an objective.
func (*DB) UpdateRelationship ¶
UpdateRelationship changes the type and description of an existing relationship.
func (*DB) UpdateSecret ¶
func (*DB) UpdateTension ¶
UpdateTension sets the tension level for a session, clamping to [1, 10].
func (*DB) UpdateWorldNote ¶
func (*DB) UpdateWorldNotePersonality ¶
type Faction ¶
type Faction struct {
ID int64 `json:"id"`
CampaignID int64 `json:"campaign_id"`
Name string `json:"name"`
Description string `json:"description"`
FactionType string `json:"faction_type"`
Influence int `json:"influence"`
ResourcesJSON string `json:"resources_json"`
Color string `json:"color"`
CreatedAt time.Time `json:"created_at"`
}
Faction represents a named faction within a campaign.
type Item ¶
type Item struct {
ID int64 `json:"id"`
CharacterID int64 `json:"character_id"`
Name string `json:"name"`
Description string `json:"description"`
Quantity int `json:"quantity"`
Equipped bool `json:"equipped"`
CreatedAt string `json:"created_at"`
}
Item represents an inventory item owned by a character.
type NpcStat ¶
type NpcStat struct {
ID int64 `json:"id"`
CampaignID int64 `json:"campaign_id"`
Name string `json:"name"`
Role string `json:"role"`
DataJSON string `json:"data_json"`
HPMax int `json:"hp_max"`
ArmorClass *int `json:"armor_class"`
InitiativeMod int `json:"initiative_mod"`
Skills string `json:"skills"`
Abilities string `json:"abilities"`
Loot string `json:"loot"`
Notes string `json:"notes"`
CreatedAt string `json:"created_at"`
}
NpcStat represents a reusable NPC combat stat block within a campaign.
type Objective ¶
type Objective struct {
ID int64 `json:"id"`
CampaignID int64 `json:"campaign_id"`
Title string `json:"title"`
Description string `json:"description"`
Status string `json:"status"`
ParentID *int64 `json:"parent_id"`
CreatedAt string `json:"created_at"`
}
Objective represents a campaign goal or quest being tracked.
type OpenOptions ¶
type OpenOptions struct {
BackupBeforeRepair bool
}
OpenOptions controls database startup behavior. A file-backed repair is refused when BackupBeforeRepair is false; the option exists so callers can make that policy explicit without permitting an unprotected repair.
type Relationship ¶
type Relationship struct {
ID int64 `json:"id"`
CampaignID int64 `json:"campaign_id"`
FromName string `json:"from_name"`
ToName string `json:"to_name"`
RelationshipType string `json:"relationship_type"`
Description string `json:"description"`
CreatedAt time.Time `json:"created_at"`
}
Relationship represents a named relationship between two characters/NPCs in a campaign.
type RulebookChunk ¶
type RulebookChunk struct {
ID int64 `json:"id"`
RulesetID int64 `json:"ruleset_id"`
Source string `json:"source"`
Heading string `json:"heading"`
Content string `json:"content"`
Embedding []byte `json:"-"`
CreatedAt time.Time `json:"created_at"`
}
RulebookChunk represents a parsed chunk of rulebook text for a given ruleset.
type RulebookSource ¶
RulebookSource summarises one uploaded book for a ruleset.
type Secret ¶
type Secret struct {
ID int64 `json:"id"`
CampaignID int64 `json:"campaign_id"`
Title string `json:"title"`
Content string `json:"content"`
Category string `json:"category"`
Revealed bool `json:"revealed"`
RevealedAtSessionID *int64 `json:"revealed_at_session_id,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
type Session ¶
type Session struct {
ID int64 `json:"id"`
CampaignID int64 `json:"campaign_id"`
Title string `json:"title"`
Date string `json:"date"`
Summary string `json:"summary"`
Notes string `json:"notes"`
SceneTags string `json:"scene_tags"`
AdventureID *int64 `json:"adventure_id"`
CreatedAt string `json:"created_at"`
}
type SessionNPC ¶
type SessionNPC struct {
ID int64 `json:"id"`
SessionID int64 `json:"session_id"`
Name string `json:"name"`
Note string `json:"note"`
CreatedAt string `json:"created_at"`
}
SessionNPC represents an NPC tracked within a session.
type TimelineEntry ¶
type TimelineEntry struct {
Type string `json:"type"`
Timestamp string `json:"timestamp"`
Data json.RawMessage `json:"data"`
}
TimelineEntry is a single chronological item in the session feed. Type is one of "message" or "dice_roll". Data is the raw JSON of the underlying record.
type WorldNote ¶
type WorldNote struct {
ID int64 `json:"id"`
CampaignID int64 `json:"campaign_id"`
Title string `json:"title"`
Content string `json:"content"`
Category string `json:"category"`
TagsJSON string `json:"tags_json"`
PersonalityJSON string `json:"personality_json"`
IsRevealed bool `json:"is_revealed"`
CreatedAt string `json:"created_at"`
}
type XPEntry ¶
type XPEntry struct {
ID int64 `json:"id"`
SessionID int64 `json:"session_id"`
Note string `json:"note"`
Amount *int `json:"amount"`
CreatedAt string `json:"created_at"`
}
XPEntry records a story milestone or XP award for a session. Amount is optional — nil for rulesets without numeric XP.
Source Files
¶
- db.go
- integrity.go
- queries_adventures.go
- queries_calendar.go
- queries_combat.go
- queries_core.go
- queries_decks.go
- queries_factions.go
- queries_items.go
- queries_macros.go
- queries_masquerade.go
- queries_npc_stats.go
- queries_npcs.go
- queries_objectives.go
- queries_oracle.go
- queries_relationships.go
- queries_rulebook.go
- queries_secrets.go
- queries_session.go
- queries_tension.go
- queries_timeline.go
- queries_tokens.go
- queries_world.go
- queries_xp.go
- queries_zones.go