Skip to content

uuid type in db is not a string in typescript #85

Answered by Newbie012
mzalevski asked this question in Q&A
Discussion options

You must be logged in to vote

What about this?

const getUser = (id: string) => {
  const users = sql`SELECT * FROM users WHERE id = '${id}::uuid'`;
};

Another solution (it's not currently implemented) is to define a type called UUID so SafeQL will know to cast it to uuid rather than a text.

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@Newbie012
Comment options

@mzalevski
Comment options

@Newbie012
Comment options

@mzalevski
Comment options

@Newbie012
Comment options

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