-
I'm trying to find out how could I convert this queries that were working on v0.28 to the new approach of version v0.29 Update: _, err = dbgen.Blocks.UpdateQ(ctx, bob.New(m.db), &dbgen.BlockSetter{CRC32: omitnull.From(crc32Bytes)},dbgen.UpdateWhere.Blocks.Key.EQ(block.Key)).Exec() Insert: _, err = dbgen.Blocks.Insert(ctx, bob.New(m.db), &dbgen.BlockSetter{
Key: omit.From(u.Key),
State: omit.From(BlockExpected.Int32()),
Bytesize: omitnull.From(u.ByteSize),
BucketID: omit.From(DefaultBucketID),
}) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Okay I think I found the way: Update: _, err = dbgen.Blocks.Update(
dbgen.BlockSetter{CRC32: omitnull.From(crc32Bytes)}.UpdateMod(),
dbgen.UpdateWhere.Blocks.Key.EQ(block.Key),
).Exec(ctx, bob.New(m.db)) Insert: _, err = dbgen.Blocks.Insert(&dbgen.BlockSetter{
Key: omit.From(u.Key),
State: omit.From(BlockExpected.Int32()),
Bytesize: omitnull.From(u.ByteSize),
BucketID: omit.From(DefaultBucketID),
}).One(ctx, bob.New(m.db)) |
Beta Was this translation helpful? Give feedback.
-
This was a godsend for someone just getting started with this project. Could some of that context not be derived from the individual model? When I tried doing this via the individual model on the docs (here), I would receive an error: |
Beta Was this translation helpful? Give feedback.
Okay I think I found the way:
Update:
Insert: