Better HN
topnewbestaskshowjobs
Log inSign up

bigpigeon

32 karma · joined Mar 1, 2018 (8y ago) · 16 submissions

Submissions

1.

Formats struct tag within Go programs(github.com ↗)

2 points · by bigpigeon · 6y ago · discuss

2.

Orm for golang Toyorm v0.4-alpha release(bigpigeon.org ↗)

2 points · by bigpigeon · 8y ago · discuss

comment 8y ago · link · parent

toyorm v0.3.1-alpha add join query

comment 8y ago · link · parent

now toyorm support join operation

comment 8y ago · link · parent

yes, codegen have better performance than reflect

but I think text/template to generate code is not really good

it hard to read and error-prone

it is more like a powerful c-macro

I think use go/ast to implement c++ likes template is other way

comment 8y ago · link · parent

when you want to make complex sql,toyorm maybe word better

find the name = "tom" user and it subquery blog title = "first blog" e.g

  brick := toy.Model(&User{}).Where("=",Offsetof(User{}.Name),"tom").
			Preload(Offsetof(User{}.Blog)).Where("=", Offsetof(Blog{}.Title), "first blog").Enter()

  brick.Find(&user)
  // raw sql
  // select id,name,data, from user where name = "tom" limit 1
  // select id,title,content,user_id from blog where user_id = @user.id and title = "first blog"
toyorm select field with Offsetof, it better when you want to refactor struct field name and you can operation main query as sub query

comment 8y ago · link · parent

In "OneToOne" and "BelongTo" Join is match but in "ManyToMany" and "OneToMany" will generate duplicate data

I think add Join method and only support "One Data" preload is good way

comment 8y ago · link · parent

you means use join to query and output data as table? otherwise I think “eager fetching” is better way

comment 8y ago · link · parent

toyorm support half hand-writing you can bind the model and use its field in sql e.g https://github.com/bigpigeon/toyorm/blob/master/examples/sim...

comment 8y ago · link · parent

preload: data association exec/query template exec: custom exec/query this is my orm great features

11.

Toyorm – ORM for Go(github.com ↗)

68 points · by bigpigeon · 8y ago · 34 comments

12.

Toyorm – a new go orm(github.com ↗)

1 points · by bigpigeon · 8y ago · discuss