Suppose $A$ and $B$ are non-empty sets and $f:A\rightarrow B$ is an onto function
What is the standard way to express this as a first order structure?
For example, one may consider a language $L$ containing a $2$-ary predicate symbol $F$ (intuitively Fxy means $(x,y)\in f$, i.e. $f(x)=y$), two $1$-ary predicate symbols $P_{A}$ and $P_{B}$ ($P_{A}x$ intuitively means $x\in A$, and similarly for $P_{B}x$), then constant symbols $c_{a}$ and $c_{b}$ for each $a\in A$ and $b\in B$ and an equality symbol $=$.
Then and onto function $f$ between the sets $A$ and $B$ is an $L$-structure $\mathcal{M}$ satisfying the obvious $L$-sentences: (onto axiom) $\forall x\;P_{B}x\Rightarrow \exists y\;P_{A}y\wedge Fyx$, the axioms $Fc_{a}c_{b}$ for all $(a,b)\in f$, and the well-defined axiom.
The domain of $\mathcal{M}$ is $A\cup B$, then $F^{\mathcal{M}}:= f$, $P_{A}^{\mathcal{M}}:=A$, $P_{B}^{\mathcal{M}}:=B$, the constant symbols are interpreted as $c_{a}^{\mathcal{M}}:=a$ and $c_{b}^{\mathcal{M}}:=b$ ($=$ is interpreted in the obvious manner).
Is my approach correct? $\mathcal{M}$ should "be" the function $f$, no? I feel I am missing something.