Is one FQL function = one tranaction?

rn , i have a situation which i need to prevent over selling

type User {
credit: Int

type Product{

I want to prevent overselling which I need to make sure User’s credit > Product’s price And Stock must be >0

If i write one fql and put all the condition there, is that mean it is in one transaction and able to prevent over selling?

To answer the question in the title, no. One query, which can involve many functions, is one transaction.

Fauna transactions are consistent. You should not have to worry about overselling. And we include an e-commerce example in our tutorials: E-commerce | Fauna Documentation

If you need to verify that stock in inventory is sufficient to complete an order in a transactional way, you would find that difficult to achieve via GraphQL, since GraphQL is unable to directly express the required conditions. That said, you should be able to write a resolver in FQL that your GraphQL queries can use to achieve your goal. See @resolver | Fauna Documentation