{"id":13741722,"url":"https://github.com/ziglibs/zorm","last_synced_at":"2025-10-08T05:31:12.554Z","repository":{"id":104374174,"uuid":"596785462","full_name":"ziglibs/zorm","owner":"ziglibs","description":"Lightweight and efficient object-relational mapping","archived":true,"fork":false,"pushed_at":"2023-05-12T08:16:37.000Z","size":2430,"stargazers_count":26,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-26T08:32:05.554Z","etag":null,"topics":["data-definition","orm","orm-framework","typesafe","zig","ziglang"],"latest_commit_sha":null,"homepage":"","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ziglibs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"github":"i0bs"}},"created_at":"2023-02-02T23:15:09.000Z","updated_at":"2024-09-28T02:04:55.000Z","dependencies_parsed_at":"2024-01-25T05:09:21.442Z","dependency_job_id":"ddbca1cd-b266-46fb-b8fd-5e0f64e100b6","html_url":"https://github.com/ziglibs/zorm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ziglibs/zorm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziglibs%2Fzorm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziglibs%2Fzorm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziglibs%2Fzorm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziglibs%2Fzorm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ziglibs","download_url":"https://codeload.github.com/ziglibs/zorm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziglibs%2Fzorm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278892117,"owners_count":26063933,"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","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["data-definition","orm","orm-framework","typesafe","zig","ziglang"],"created_at":"2024-08-03T04:01:02.083Z","updated_at":"2025-10-08T05:31:12.275Z","avatar_url":"https://github.com/ziglibs.png","language":"Zig","funding_links":["https://github.com/sponsors/i0bs"],"categories":["Libraries"],"sub_categories":[],"readme":"\u003ccenter\u003e\n    \u003cimg src=\"https://user-images.githubusercontent.com/41456914/217338569-05b2fa34-e40e-434b-8f2f-41bf12502277.png\" /\u003e\n\u003c/center\u003e\n\n## Abstract\n\nNotice\n|-\nThis library has [moved over to Snowflake.](https://github.com/snwfke/zorm)\n\nzorm is not your traditional ORM tool. Unlike other ORMs, zorm is designed to provide types for\nmaking object-relational mapping within your scripts simple and not reliant on database table\nparadigms.\n\nIn zorm, objects are cast on manually defined fields that can be compared:\n\n### Object mapping\n\n```zig\nconst std = @import(\"std\");\n\n// In this example, we'll be mapping our object from JSON.\n// For this very specific use case, zorm will handle assuming types to be tight and memory-bound.\nconst dumb_payload =\n    \\\\{\n    \\\\   \"foo\": \"hello, world\",\n    \\\\   \"bar\": 420\n    \\\\}\n;\n\nconst zorm = @import(\"zorm\");\n\n// Objects are defined as a sort of \"factory method.\" The inner argument is a comptime-known\n// anonymous struct literal containing fields.\nconst Foo = zorm.Object(.{\n    // (comptime T: type, data: ?FieldMetadata)\n    // Fields can have a name, description and default value.\n    zorm.Field(?[]const u8, .{ .name = \"foo\", .default = undefined }),\n    zorm.Field(usize, .{ .name = \"bar\" })\n});\n\npub fn main() !void {\n    // With an object defined, we can now generate our own from our payload.\n    // (comptime T: type, data: anytype)\n    const myFoo: zorm.Object = try zorm.create(Foo, .{ .JsonString = dumb_payload });\n\n    // Accessing data is now done through the newly created object.\n    std.debug.print(\"{any}\\n\", .{myFoo.get(\"foo\")});\n}\n```\n\n### Using datatypes\n\nzorm provides you a set of datatypes. An example of a datatype is `Date`:\n\n```zig\npub fn main() !void {\n    // We can build a date from a string, useful for defaults.\n    const date = try zorm.Date.fromString(\"2002-07-23\", .@\"YYYY-MM-DD\");\n\n    // This is an ISO 8601 format, which zorm will intelligently determine\n    const payload =\n        \\\\{\n        \\\\    \"date\": \"1999-12-31\"\n        \\\\}\n    ;\n    const NewTable = try zorm.create(\n        zorm.Object(.{\n            // Default values must either be undefined or part of the type specified in the field,\n            // as expected when working with structs.\n            zorm.Field(?zorm.Date, .{ .name = \"date\", .default = date })\n        }),\n        .{ .JsonString = payload }\n    );\n\n    // 1999 will be returned instead of 2002.\n    std.debug.print(\"{?}\\n\", .{NewTable.get(\"date\").f_type.year});\n}\n```\n\n## Building\n\nzorm runs on 0.10.0-dev and higher versions of [Zig](https://ziglang.org).\n\nIt is recommended to install and build from source:\n\n```bash\n$ git clone --recursive https://github.com/ziglibs/zorm\n$ cd ./zorm\n$ zig build\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fziglibs%2Fzorm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fziglibs%2Fzorm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fziglibs%2Fzorm/lists"}