Exporting functions
Modus uses the default conventions for each language.- Go
- AssemblyScript
Functions written in Go use starting capital letters to expose functions as public. Modus
creates an external API for public functions from any file that belongs to the Since the
main package.The functions below generate an API endpoint with the signatureclassify function isn’t capitalized, Modus doesn’t include it in the
generated GraphQL API.Generating mutations
By default, all exported functions are generated as GraphQL queries unless they follow specific naming conventions that indicate they perform mutations (data modifications). Functions are automatically classified as mutations when they start with these prefixes:mutatepost,patch,put,deleteadd,update,insert,upsertcreate,edit,save,remove,alter,modifystart,stop
getUserById→ QuerylistProducts→ QueryaddUser→ MutationupdateProduct→ MutationdeleteOrder→ Mutation
addPost becomes a mutation, but
additionalPosts remains a query since “additional” doesn’t match the exact
“add” prefix pattern.