Postgres module

Loaded_Many

structsince 0.27.0Source

The rows parents have through the has-many relation relation (a @pg_has_many note of T), in one query: items[i] belongs to parents[i]. Free it with free_loaded; the items read from its result.

Example
posts, error := Pg.load_many(db, users, "posts");
for users print("% wrote % posts\n", it.email, posts.items[it_index].count);

Not run: the example is marked ignore.

Not run: it needs a PostgreSQL server.

Fields

items: [][] Item
rows: [] Item
Every item once; items are views into it.
result: Result

See also