How to select from a function with parameters?

Ttheogravity5/22/2023
I understand that kysely will not natively support stored procedures / functions, and was wondering if there's a pattern for this:
select * from function_name(<parameters>)

I created a helper:
export function similaritySearch(
  text: string,
  model: string,
) {
  return sql`similarity_search(${sql.lit(text)}, ${sql.lit(model)})`;
}

But, I'm not exactly sure how I can use that since db.selectFrom() expects a table name.
Oohmi5/22/2023
https://kysely-org.github.io/kysely/interfaces/Sql.html
is this what you're looking for?
const result = await sql<Person[]>`select * from person`.execute(db)
Ttheogravity5/22/2023
Thanks. I think this might work:

export function similaritySearch(text: string, model: string) {
  return sql<SimilaritySearchTable>`similarity_search(${sql.lit(text)}, ${sql.lit(model)})`;
}

await sql<SimilaritySearchRow[]>`SELECT * FROM ${similaritySearch(text, model)}`.execute(db);