eaigner / hood

Database agnostic ORM for Go
MIT License
708 stars 52 forks source link

Title case field naming #61

Closed robfig closed 11 years ago

robfig commented 11 years ago

I want to use this with a database that has a TitleCase naming convention -- is there any way to do it? I didn't see any way to override the snake cased naming convention.

Thanks!

eaigner commented 11 years ago

There is currently no way to override the snake cased conversion

robfig commented 11 years ago

FYI, I am implementing the TechEmpower Benchmarks with a couple different Go ORMs and submitting the fastest one as the Revel entry. I would be overjoyed to benchmark Jet and Hood if you were to make them compatible with the test setup (MySQL with TitleCase naming convention).

Here is the revel-framework discussion. https://groups.google.com/forum/?hl=en#!msg/revel-framework/-3vC9P0Kk2Q/Y5aXviDWERYJ

Round 6 has ETA June 17

eaigner commented 11 years ago

Hi Rob!

I might be able to do it for Jet. Where exactly is the test setup specified?

With Hood it's a different story, because currently I'm pursuing the Jet way of doing things - keeping it lightweight and flexible. I first started implementing Hood, but found that trying to do everything - without writing any SQL - really limits the ORMs flexibility a lot.

So Jet is supposed to be the "encoding/json decode equivalent" for SQL rows, if you will.

eaigner commented 11 years ago

Oh I think I understand. I'm just supposed to create a revel app that outputs the specified HTTP JSON responses on http://www.techempower.com/benchmarks/ ?

robfig commented 11 years ago

Yep. Here was my attempt: https://github.com/robfig/FrameworkBenchmarks/tree/jet

(see revel/src/benchmark/app/...)

To run it yourself, you can:

  1. git clone git@github.com:robfig/FrameworkBenchmarks.git
  2. cd FrameworkBenchmarks
  3. git checkout jet
  4. export GOPATH=pwd
  5. cd revel
  6. go get github.com/robfig/revel/revel
  7. bin/revel run benchmark prod 8080
  8. (In another terminal) wrk -d 30 -c 256 -t 2 http://localhost:8080/db?queries=20

You will want to warm up the server (e.g. with a 5 second test) to avoid taking startup cost into account.

There are many other tests than that one (I gave you the command line for a 20-query 256-concurrency test), but that should be representative.

So far I have successfully implemented the benchmark for Gorp and QBS. QBS is in the lead right now.

Right now, on my local workstation, I am getting these numbers for the average requests / sec:

Go - 1164 Revel (raw) - 1140 Revel (QBS) - 986

Here's my results for the one-query test:

Go - 13497 Revel (raw) - 11600 Revel (QBS) - 9734

I'm happy to give you push access to that repo if you want (or you can fork, up to you)

robfig commented 11 years ago

Also, I am totally down with the Jet way of doing things! I personally think that powerful tools for mapping result sets to objects (even complicated mappings like one-to-many collection properties) is the main goal, but extra stuff like trying to model SQL in objects is overkill.

Although, helpers for super common things like FindById and FindAll are nice :)

eaigner commented 11 years ago

Actually, I think I'll make this a hack night and optimize Jet for this benchmark. Perfect opportunity to do some tuning.

I'll fork it and send you a pull request when it's done.