1. 05 1月, 2015 2 次提交
  2. 04 1月, 2015 1 次提交
  3. 19 12月, 2014 1 次提交
  4. 18 12月, 2014 2 次提交
  5. 13 12月, 2014 2 次提交
  6. 09 12月, 2014 2 次提交
  7. 08 12月, 2014 2 次提交
  8. 04 12月, 2014 1 次提交
  9. 28 11月, 2014 3 次提交
  10. 26 11月, 2014 5 次提交
    • J
      Merge pull request #300 from jnfeinstein/master · 13c1b448
      Jinzhu 提交于
      .Count() should always use ToSnake'd foreign keys.
      13c1b448
    • J
      Add support for polymorphic relationships using the POLYMORPHIC setting. · 8b451f00
      jnfeinstein 提交于
      This commit adds support for two settings:
      
      FOREIGNTYPE - A field that is used to store the type of the owner.
      
      POLYMORPHIC - A shortcut to set FOREIGNKEY and FOREIGNTYPE to the same
      value suffixed by "Id" and "Type" respectively.
      
      The type is stored as the table name, which I thought might be useful
      for other queries.
      
      The biggest gotcha of this commit is that I flipped the definition of
      has_one and belongs_to. gorm is very flexible such that it didn't
      really care if it was a has_one or belongs_to, and can pretty much
      determine it at runtime. For the sake of the error, I had to define
      one of them as belongs_to, and I chose the one with the fields as
      the belongs_to, like ActiveRecord. The error could probably be
      genericized to "gorm cannot determine type", but I think it's nicer
      to tell people DONT DO PATTERN XYZ CAUSE IT WONT WORK. Functionally,
      it doesn't matter.
      8b451f00
    • J
      Add test for polymorphic associations. · 1de020dc
      jnfeinstein 提交于
      1de020dc
    • J
      Add README.md updates for polymorphism. · 7e8c0f7e
      jnfeinstein 提交于
      7e8c0f7e
    • J
      .Count() should always use ToSnake'd foreign keys. · 794e1ba2
      jnfeinstein 提交于
      It looks like gorm always uses the snake form of a column by
      convention, as seen by searching DBName in scope.go. These counts
      were erroring out without the ToSnake'd foreign keys.
      
      Further, the code for has_many and has_one becomes the same (which
      makes sense), so I combined the two cases.
      794e1ba2
  11. 25 11月, 2014 5 次提交
  12. 24 11月, 2014 2 次提交
  13. 21 11月, 2014 1 次提交
  14. 19 11月, 2014 1 次提交
  15. 18 11月, 2014 1 次提交
  16. 17 11月, 2014 4 次提交
    • J
      Add additional methods of specifying the 'select' portion of a query. · 429a1008
      jnfeinstein 提交于
      This commit adds more ways of specifying selects:
      
      -) You can now pass in a []string.  This is mostly for convenience,
      since you may want to dynamically create a list of fields to be
      selected.
      
      -) You can now use variables.  This is important because a select
      could take user input.  For example, finding a MAX between a record
      and a given number could be easily done using select, and then
      you don't have to process anything in backend logic.  This is also
      necessary to use postgres text search capabilities (which actaully
      play nicely with the rest of gorm).
      
      -) You can now chain select calls.  This could be useful in
      conjunction with gorm's scopes functionality.
      429a1008
    • R
      Create tables with fields in same order as defined in struct · 62b447bc
      ryanss 提交于
      62b447bc
    • J
      Merge pull request #280 from ryanss/master · 8482d0a1
      Jinzhu 提交于
      Create tables with fields in same order as defined in struct
      8482d0a1
    • J
      Refactor DefaultValue · 75819b2b
      Jinzhu 提交于
      75819b2b
  17. 16 11月, 2014 2 次提交
  18. 12 11月, 2014 3 次提交