Refactored single almanach view

This commit is contained in:
Simon Martens
2025-02-25 22:13:02 +01:00
parent 4d65b71563
commit 0a9e71d4e3
11 changed files with 321 additions and 171 deletions

View File

@@ -14,7 +14,7 @@ import (
// For scanning, with an Iter_ prefix, yields single row results
func REntriesAgents_Agent(app core.App, id string) ([]*REntriesAgents, error) {
return TableByField[[]*REntriesAgents](
return TableByFields[[]*REntriesAgents](
app,
RelationTableName(ENTRIES_TABLE, AGENTS_TABLE),
AGENTS_TABLE,
@@ -23,7 +23,7 @@ func REntriesAgents_Agent(app core.App, id string) ([]*REntriesAgents, error) {
}
func REntriesAgents_Entry(app core.App, id string) ([]*REntriesAgents, error) {
return TableByField[[]*REntriesAgents](
return TableByFields[[]*REntriesAgents](
app,
RelationTableName(ENTRIES_TABLE, AGENTS_TABLE),
ENTRIES_TABLE,
@@ -32,7 +32,7 @@ func REntriesAgents_Entry(app core.App, id string) ([]*REntriesAgents, error) {
}
func RContentsAgents_Agent(app core.App, id string) ([]*RContentsAgents, error) {
return TableByField[[]*RContentsAgents](
return TableByFields[[]*RContentsAgents](
app,
RelationTableName(CONTENTS_TABLE, AGENTS_TABLE),
AGENTS_TABLE,
@@ -40,8 +40,17 @@ func RContentsAgents_Agent(app core.App, id string) ([]*RContentsAgents, error)
)
}
func REntriesSeries_Entries(app core.App, ids any) ([]*REntriesSeries, error) {
return TableByField[[]*REntriesSeries](
func RContentsAgents_Contents(app core.App, id []any) ([]*RContentsAgents, error) {
return TableByFields[[]*RContentsAgents](
app,
RelationTableName(CONTENTS_TABLE, AGENTS_TABLE),
CONTENTS_TABLE,
id,
)
}
func REntriesSeries_Entries(app core.App, ids []any) ([]*REntriesSeries, error) {
return TableByFields[[]*REntriesSeries](
app,
RelationTableName(ENTRIES_TABLE, SERIES_TABLE),
ENTRIES_TABLE,
@@ -49,18 +58,55 @@ func REntriesSeries_Entries(app core.App, ids any) ([]*REntriesSeries, error) {
)
}
func REntriesSeries_Entry(app core.App, id string) ([]*REntriesSeries, error) {
return TableByFields[[]*REntriesSeries](
app,
RelationTableName(ENTRIES_TABLE, SERIES_TABLE),
ENTRIES_TABLE,
id,
)
}
func Agents_ID(app core.App, id string) (*Agent, error) {
return TableByID[*Agent](app, AGENTS_TABLE, id)
r, err := TableByID[Agent](app, AGENTS_TABLE, id)
return &r, err
}
func Agents_IDs(app core.App, ids []any) ([]*Agent, error) {
return TableByIDs[[]*Agent](app, AGENTS_TABLE, ids)
}
func Entries_ID(app core.App, id string) (*Entry, error) {
e, err := TableByID[Entry](app, ENTRIES_TABLE, id)
return &e, err
}
func Entries_MusenalmID(app core.App, id string) (*Entry, error) {
ret, err := TableByField[Entry](app, ENTRIES_TABLE, MUSENALMID_FIELD, id)
return &ret, err
}
func Entries_IDs(app core.App, ids []any) ([]*Entry, error) {
return TableByID[[]*Entry](app, ENTRIES_TABLE, ids)
return TableByIDs[[]*Entry](app, ENTRIES_TABLE, ids)
}
func Series_IDs(app core.App, ids []any) ([]*Series, error) {
return TableByID[[]*Series](app, SERIES_TABLE, ids)
return TableByIDs[[]*Series](app, SERIES_TABLE, ids)
}
func Places_IDs(app core.App, ids []any) ([]*Place, error) {
return TableByIDs[[]*Place](app, PLACES_TABLE, ids)
}
func Contents_IDs(app core.App, ids []any) ([]*Content, error) {
return TableByID[[]*Content](app, CONTENTS_TABLE, ids)
return TableByIDs[[]*Content](app, CONTENTS_TABLE, ids)
}
func Contents_Entry(app core.App, id string) ([]*Content, error) {
return TableByFields[[]*Content](
app,
CONTENTS_TABLE,
ENTRIES_TABLE,
id,
)
}