Insert value generated by SQL func (crypt) and return model #343
-
I want to insert user with password into database using crypt function for hashing. INSERT INTO users(login, password) VALUES
('login', crypt('password', gen_salt('bf'))); How can i do this with bob? I tried code generation but Setters doesn't provide an option to define a value generated by SQL func. |
Beta Was this translation helpful? Give feedback.
Answered by
stephenafamo
Jan 19, 2025
Replies: 1 comment 1 reply
-
Yes, you would have to use the query builder. models.Users.Insert(
im.Values(
psql.Arg("[email protected]"),
psql.Raw("crypt(?, gen_salt('bf'))", "password"),
),
) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
VRmnv
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, you would have to use the query builder.