Skip to content

How to use the new Update and Insert Queries from v0.29 #308

Answered by pcriv
pcriv asked this question in Q&A
Discussion options

You must be logged in to vote

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))

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by stephenafamo
Comment options

You must be logged in to vote
2 replies
@stephenafamo
Comment options

@Quip1995
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants