4 ms·
One of the features listed is "Mapping with nested structs", but there's no example of this. Given that this would be a feature setting your project apart from
by mdasen 10y ago
One of the features listed is "Mapping with nested structs", but there's no example of this. Given that this would be a feature setting your project apart from many of the Go "ORMs" out there, it would be nice to have an example.
Maybe something with two tables: an "authors" table and a "books" table. Then an example of getting authors each struct of which has a `[]Book` of books.
- samonzeweb 10y agoNested structs are shown in the documentation : https://godoc.org/github.com/samonzeweb/godb#hdr-Structs_mapping https://godoc.org/github.com/samonzeweb/godb#hdr-Structs_map... It's composition tool, not a relational one. Sorry.
- chrisan 10y ago> It's composition tool, not a relational one. Sorry. Isn't the R in ORM for relational?
- samonzeweb 10y ago> > It's composition tool, not a relational one. Sorry. > Isn't the R in ORM for relational? I spoke about the nested structs. You can have nested structs for something else than relational mapping. As I replied to masklinn , I was not sure how to qualify godb, and I admit that ORM is not a perfect qualifier.
- camus2 10y agoYour library is a query builder, not an ORM.
- masklinn 10y agoORM is a tool to map an object model (with which the developer interacts) onto a relational one, the R part is the one which ORMs try to hide, not the one they're trying to surface.
- camus2 10y ago> ORM is a tool to map an object model No, ORM means Object Relational Mapper. if your ORM doesn't support relations between tables, then it is not a ORM. Given a relationship between 2 tables, an ORM will at the very least fetch related records when rows from a table are loaded. > godb does not manage relationships like Active Record or Entity Framework, Godb is therefore NOT an ORM. The title is misleading. People can't just make up definitions like that. It's either an ORM or it is not. Godb looks like a simple query builder.
- masklinn 10y ago> Godb is therefore NOT an ORM. […] Godb looks like a simple query builder. Yeah I already said that: https://news.ycombinator.com/item?id=13184341 https://news.ycombinator.com/item?id=13184341
- rantanplan 10y agoRelational comes from Relation which means "table", not relationship. There's no relationship between 2 tables. You're probably referring to foreign keys, but these are just constraints, not relationships in the sense you're alluding in your comment.
- blitzd 10y agoWhile that may be true in the definition of a relational database, that is not generally what is meant by an ORM. The relationships between objects are a key part of what an ORM would provide.
- rantanplan 10y agoActually it's exactly what is meant by ORM. Object Relational Mapper: It maps Objects to Relations. Everything else is just auxiliary functionality. Although I get what you're saying, and indeed the facility you describe is very convenient, it's not what the term means. I'm just pointing that out because obviously people conflate relation(which comes from relational theory) with relationships.