Commit graph

266 commits

Author SHA1 Message Date
Maksim
bdd28d9d5b fix removing whitespace 2017-04-24 12:46:56 -04:00
Aaron L
0818af0e26 Don't use XSlice where unneeded.
- In the bowels of the eager loading we weave in and out of reflection,
  but we should not care about using XSlice unless it's going back to
  the user. This change makes it so the XSlice is only used where it
  matters, everywhere else is *[]*X to avoid type assertion errors from
  being able to have either or come into the Load() functions.
- Fix #124
2017-04-04 19:44:36 -07:00
Aaron L
10cfe74989 Fix a bug that could occur on no-field inserts 2017-04-04 19:42:49 -07:00
Aaron L
d13410617f Correct whitespace errors 2017-04-04 19:40:12 -07:00
Sergey Kurt
fd2c7ad764 Fixed Upsert statement for postgres, mysql 2017-04-02 12:27:33 +03:00
Sergey Kurt
b2acda8ade Generic Select statement in Reload 2017-04-01 21:11:01 +03:00
Sergey Kurt
f913d5e791 Generic Delete statement 2017-04-01 21:08:29 +03:00
Sergey Kurt
178d925c24 Generic Update statement 2017-04-01 21:00:13 +03:00
Sergey Kurt
783e7a82b3 Choosing StartIndex at template time 2017-04-01 20:30:40 +03:00
Sergey Kurt
dfbcef7fe3 Fixed typo and combined variables declaration 2017-03-31 11:27:34 +03:00
Sergey Kurt
b10df110a0 Newline at end of file 2017-03-31 11:05:52 +03:00
Sergey Kurt
b4fc4447f8 Fixed trim direction 2017-03-31 11:03:16 +03:00
Sergey Kurt
83b935168f Branching with if-else 2017-03-31 10:59:03 +03:00
Sergey Kurt
8ef33a1127 PkgName in error 2017-03-31 10:52:54 +03:00
Sergey Kurt
9bafa2f158 MSSQL Upsert statement 2017-03-21 13:04:07 +03:00
Sergey Kurt
13bdda4e20 Simplified insert query 2017-03-19 18:12:06 +03:00
Sergey Kurt
d40d074320 Filtering columns with auto values 2017-03-19 12:44:15 +03:00
Sergey Kurt
12dce9d986 Auto columns in Inserts removed 2017-03-19 12:42:55 +03:00
Sergey Kurt
f3f8074833 Removed blank lines and spaces 2017-03-18 15:18:04 +03:00
Sergey Kurt
b1b0249898 New line at end of file 2017-03-16 11:01:49 +03:00
Sergey Kurt
8de60ee26a Update and Insert for columns with autogenerated values 2017-03-16 10:54:55 +03:00
Sergey Kurt
e943c37a99 Update and Insert only for columns without autogenerated 2017-03-16 10:26:05 +03:00
Sergey Kurt
4c2062caee Fixed code generation for Update and Reload 2017-03-15 19:35:44 +03:00
Sergey Kurt
f45f98ef03 Fixed placeholders 2017-03-15 19:13:20 +03:00
Sergey Kurt
ad15668462 Fixed code generation 2017-03-15 19:04:13 +03:00
Sergey Kurt
51e9961f0a Fixed OUTPUT values on Insert 2017-03-14 18:06:33 +03:00
Sergey Kurt
a48e5f7f82 MS SQL compatible query for RETURNING clause 2017-03-14 16:52:54 +03:00
Sergey Kurt
aa01f21b5c Pass UseTopClause flag into the Dialect object 2017-03-14 13:59:05 +03:00
Sergey Kurt
ed6dad7eed MS SQL compatible query for checks if the row exists 2017-03-14 13:53:35 +03:00
Sergey Kurt
83d90f3f28 Fixed quote symbols order 2017-03-14 13:48:38 +03:00
Sergey Kurt
e00ea60679 Initial MSSQL support 2017-03-13 12:55:26 +03:00
Aaron L
8f96ba35d6 Allow insertion of only-defaulted tables
- Tables that are only comprised of default values and have nothing
  passed into them on insertion will no longer generate syntax errors.
2017-03-01 18:18:47 -08:00
Aaron L
a5cb765403 Ensure created_at isn't updated when unnecessary
- When we build the update whitelist (when the user doesn't provide one)
  we simply say that the whitelist is all columns except pkeys. The
  reason we do this is because sqlboiler doesn't support dirty tracking
  and if you want to update just a few fields, it's easier to just
  explicitly pass a whitelist when you update. However, in the case of
  created_at - it's a field that's usually managed by us and so we
  should not be updating it unless a user explicitly requests it via the
  whitelist. So if the whitelist is empty we prune that column now if it
  exists from the auto-created whitelist.
- The user also reported that upsert has the same fate, but the logic is
  somewhat different there. It expects that there's a value for
  created_at or it assumes that one needs to be created. There's no
  more magic we can do around this one unfortunately. Upsert is a
  mythical beast that doesn't play as nicely with our model, so users
  will just have to be more careful.
- Fix #106
2017-02-24 22:52:09 -08:00
Aaron L
8aa4e2148c Use _ to avoid reserved words in func args
- Fix #107
2017-02-24 22:27:05 -08:00
Aaron L
59c238539d Attach all eagerly loaded models in to-one
- The problem here is that due to the nature of the relationship and the
  way the loop was set up it was possible to miss some relationships:

A _ C
 \_ D

B _ E
 \_ F

Since we looped over A and B and did a break when we found something to
attach it to (in this example A would find C) it would break. What we
should be looping through is CDEF and finding a home for each one.

Did the same change in to_one though it doesn't matter since it's
one-to-one.

to-many is untouched because it's already looping over CDEF and finding
a home for it because the relationship is reversed.

- Fix #98
2017-01-26 22:06:47 -08:00
Aaron L
c02a2f0c20 Fix null dereference 2017-01-24 23:04:59 -08:00
Aaron L
936df65ebc Fix ToManyRemoveOp
- This would generate a bad query when run, also the test was failing
  for this same reason and once enabled it was trivial to fix.
2017-01-24 22:45:20 -08:00
Aaron L
c33bb479a1 Fix postgres placeholders for to-many.RemoveX
- Help fix #97
2017-01-24 18:57:45 -08:00
Aaron L
61ab7e254a Add missing function variants for setops.
- Fix #87
2017-01-09 21:06:47 -08:00
Aaron L
22f7a45847 Ignore empty errors on postgres upsert fail
- Postgres's behavior when there is no update is that there is an
  ErrNoRows thrown back, which we can safely ignore since the only time
  this can happen in postgres's case is under this circumstance since
  there's no race unlike the mysql upsert code.
- Fix #84
2017-01-05 21:31:43 -08:00
Aaron L
4ae9336538 Fix bug in ToManySetOpsAdd and impure join tables
- This is a bug that manifests itself a bunch with our update code where
  you cannot actually use the update method to update a key since it
  uses the values on the struct to both update the values and find the
  object to update but in this operation the key must have two different
  values.
2017-01-04 20:31:29 -08:00
Aaron L
b6b16b8dd6 Fix combining relationship query mods
- Fix #67
2016-11-15 21:57:21 -08:00
Aaron L
ede97dea5b Add enum const generation
- Make postgres name its enums
- Add way to filter columns by whether or not they're an enum
- Split parsing of enums into name & values
- Add strmangle check functions: IsEnumNormal, ShouldTitleCaseEnum
- Add new strmangle enum functions to template test
- Implement a set type called "once" inside the templates so that we can
  ensure certain things only generate one time via some unique name.
2016-11-11 01:06:30 -08:00
Aaron L
3046214fb6 Ensure that relationship structs aren't clobbered
- There was no thought put in if a relationship struct already existed
  when it went to be used a second time so it was being clobbered.
- Fix #39
2016-11-08 18:25:15 -08:00
Aaron L
2c534361e1 When .LoadX gets called, create R structs
- Fix #51
- This is a waste of allocations, but in general makes for a much nicer
  user interface.
2016-09-29 19:32:43 -07:00
Aaron L
32290d9236 Fix mysql LastInsertId() 2016-09-24 16:10:26 -07:00
Aaron L
5f394a4f69 Fix one-to-one setops 2016-09-24 14:34:31 -07:00
Aaron L
09ed5709e5 Fix template spacing with new output
- The old templates used to output \n\n after each run, with the
  previous changes this is no longer the case and as such the templates
  all must be formatted correctly.
2016-09-24 00:52:18 -07:00
Aaron L
e9eda8fa1b Revert "Copy to_one_setops into one_to_one_setops"
This reverts commit e157a59714.
2016-09-24 00:23:17 -07:00
Patrick O'brien
e157a59714 Copy to_one_setops into one_to_one_setops 2016-09-24 12:42:39 +10:00