{"id":18471170,"url":"https://github.com/alyti/surrealdb_functions","last_synced_at":"2025-04-08T11:32:06.014Z","repository":{"id":183216727,"uuid":"669533667","full_name":"alyti/surrealdb_functions","owner":"alyti","description":"proc-macro to help with using surrealdb's custom functions","archived":false,"fork":false,"pushed_at":"2023-09-18T08:33:15.000Z","size":41,"stargazers_count":7,"open_issues_count":8,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-24T20:26:58.474Z","etag":null,"topics":["parser","proc-macro","rust","surrealdb"],"latest_commit_sha":null,"homepage":"https://lib.rs/crates/surrealdb_functions","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alyti.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-22T15:34:23.000Z","updated_at":"2023-12-10T19:37:10.000Z","dependencies_parsed_at":"2024-11-06T10:16:06.456Z","dependency_job_id":"1ecc13e1-409d-452b-9c62-a9a81f7d8cf8","html_url":"https://github.com/alyti/surrealdb_functions","commit_stats":null,"previous_names":["alyti/surrealdb_functions"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alyti%2Fsurrealdb_functions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alyti%2Fsurrealdb_functions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alyti%2Fsurrealdb_functions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alyti%2Fsurrealdb_functions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alyti","download_url":"https://codeload.github.com/alyti/surrealdb_functions/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247833969,"owners_count":21003895,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["parser","proc-macro","rust","surrealdb"],"created_at":"2024-11-06T10:16:03.048Z","updated_at":"2025-04-08T11:32:05.568Z","avatar_url":"https://github.com/alyti.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SurrealDB Functions [![Crates.io](https://img.shields.io/crates/v/surrealdb_functions.svg)](https://crates.io/crates/surrealdb_functions) [![Docs.rs](https://docs.rs/surrealdb_functions/badge.svg)](https://docs.rs/surrealdb_functions)\n\nThis is a proc-macro crate that given a path to a .surql file or a folder of .surql files, will parse `DEFINE FUNCTION fn::`s inside them and output rust fns that wrap around them. \nIt will also generate a bootstrap function that stores the defined functions to db, and finally if a function is nested (`fn::a::nested::function`) it will be put in a nested module.\n\n## Usage\n\nExample usage can be found in [examples/main.rs](/examples/main.rs), but in short, its main usage is as follows:\n\n```rust\ninclude_fn!{\n    driver as is;\n    datastore as ds_$;\n    \"$CARGO_MANIFEST_DIR/tests/main.surql\"\n}\n```\n\nWhen calling the macro you need to provide what naming the bindings should use: `driver/datastore as is/prefix_$/$_suffix` \n* `is` will not apply any changes to the method names.\n* `prefix_$`/`$_suffix` will replace `$` with function name, effectively prefixing/suffixing it (ex. `prefix_greet` / `greet_suffix`)\n\nAt least one of `driver/datastore` must be defined.\n\n* `driver` will generate regular `Surreal\u003cC\u003e` bindings.\n* `datastore` will generate bindings for the more low-level locally-available-only `surrealdb::kvs::Datastore`\n\nIf both are defined, the parser will validate they don't conflict. (ex. you can't have both be `as is`)\n\nFinally the last argument type is a file/directory path, if a directory is provided, it will be recursively resolved.\n\nAt least one valid path argument is expected, but more can be supplied.\nAll resolved are stored in a hashset internally so path duplication should be a non-issue.\n\nThe docs.rs content is coming later, for now either read the source or ask me in surrealdb discord (same handle as on github).\nI am open to new feature/pull requests.\n\n## Crate notes\n\nThis is a utility proc-macro for surrealdb, as such it expects presence of surrealdb in user's dependencies.\nHowever, this crate by itself, does not depend on surrealdb.\n\n## Parser notes\n\nCurrently this macro only has the minimal surrealql parser for resolving the custom function definitions, sans their body.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falyti%2Fsurrealdb_functions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falyti%2Fsurrealdb_functions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falyti%2Fsurrealdb_functions/lists"}