{"id":25961720,"url":"https://github.com/ttab/darknut","last_synced_at":"2026-05-12T19:06:27.185Z","repository":{"id":189741297,"uuid":"681182623","full_name":"ttab/darknut","owner":"ttab","description":"Darknut can be used to unmarshal a NewsDoc into a specialised struct.","archived":false,"fork":false,"pushed_at":"2024-04-08T14:39:33.000Z","size":332,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-04-14T09:08:35.625Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","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/ttab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-08-21T12:58:52.000Z","updated_at":"2023-08-21T14:27:09.000Z","dependencies_parsed_at":"2023-08-21T15:59:31.843Z","dependency_job_id":"f19e4de4-b5fc-4a7b-b7f6-d64c58f4cfe0","html_url":"https://github.com/ttab/darknut","commit_stats":null,"previous_names":["ttab/darknut"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttab%2Fdarknut","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttab%2Fdarknut/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttab%2Fdarknut/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttab%2Fdarknut/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ttab","download_url":"https://codeload.github.com/ttab/darknut/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241912997,"owners_count":20041457,"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":[],"created_at":"2025-03-04T19:41:12.144Z","updated_at":"2026-05-12T19:06:27.116Z","avatar_url":"https://github.com/ttab.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Darknut\n\n[![GoDev](https://img.shields.io/static/v1?label=godev\u0026message=reference\u0026color=00add8)][godev]\n[![Build Status](https://github.com/ttab/darknut/actions/workflows/test.yaml/badge.svg?branch=main)][actions]\n\n\u003cp\u003e\n  \u003cimg src=\"https://github.com/ttab/darknut/raw/main/docs/darknut.png?raw=true\" width=\"256\" alt=\"The Darknut\"\u003e\n\u003c/p\u003e\n\nDarknut can be used to unmarshal a NewsDoc into a specialised struct. Mostly useful for getting strict typing of data attributes and flattening the data structure.\n\nSlices of blocks and fields that are pointers will be treated as optional, all others will result in an error. External types, like UUIDs, are supported through [TextUnmarshaler](https://pkg.go.dev/encoding#TextUnmarshaler).\n\n``` go\ntype planningItem struct {\n    UUID                uuid.UUID         `newsdoc:\"uuid\"`\n    Title               string            `newsdoc:\"title\"`\n    Meta                planningItemBlock `newsdoc:\"meta,type=core/planning-item\"`\n    InternalDescription *descriptionBlock `newsdoc:\"meta,type=core/description,role=internal\"`\n    PublicDescription   *descriptionBlock `newsdoc:\"meta,type=core/description,role=public\"`\n    Assignments         []assignmentBlock `newsdoc:\"meta,type=core/assignment\"`\n}\n\ntype descriptionBlock struct {\n    Role string `newsdoc:\"role\"`\n    Text string `newsdoc:\"data.text\"`\n}\n\ntype planningItemBlock struct {\n    Date        *time.Time `newsdoc:\"data.date,format=2006-01-02\"`\n    Publish     time.Time  `newsdoc:\"data.publish\"`\n    PublishSlot *int       `newsdoc:\"data.publish_slot\"`\n    Public      bool       `newsdoc:\"data.public\"`\n    Tentative   bool       `newsdoc:\"data.tentative\"`\n    Urgency     int        `newsdoc:\"data.urgency\"`\n}\n\ntype assignmentBlock struct {\n    Starts    time.Time        `newsdoc:\"data.starts\"`\n    Ends      *time.Time       `newsdoc:\"data.ends\"`\n    Status    string           `newsdoc:\"data.status\"`\n    FullDay   bool             `newsdoc:\"data.full_day\"`\n    Kind      []assignmentKind `newsdoc:\"meta,type=core/assignment-kind\"`\n    Assignees []assigneeLink   `newsdoc:\"links,rel=assignee\"`\n}\n\ntype assignmentKind struct {\n    Value string `newsdoc:\"value\"`\n}\n\ntype assigneeLink struct {\n    UUID uuid.UUID `newsdoc:\"uuid\"`\n}\n```\n\nSee the [documentation][godev] for more information.\n\n[godev]: https://pkg.go.dev/github.com/ttab/darknut\n[actions]: https://github.com/ttab/darknut/actions\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fttab%2Fdarknut","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fttab%2Fdarknut","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fttab%2Fdarknut/lists"}