{"id":17004804,"url":"https://github.com/clickermonkey/refstr","last_synced_at":"2025-06-19T20:35:25.703Z","repository":{"id":65389463,"uuid":"580211045","full_name":"ClickerMonkey/refstr","owner":"ClickerMonkey","description":null,"archived":false,"fork":false,"pushed_at":"2023-01-20T04:26:23.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-27T10:23:08.486Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ClickerMonkey.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-12-20T01:45:08.000Z","updated_at":"2022-12-21T04:47:16.000Z","dependencies_parsed_at":"2023-02-11T23:45:25.222Z","dependency_job_id":null,"html_url":"https://github.com/ClickerMonkey/refstr","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ClickerMonkey%2Frefstr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ClickerMonkey%2Frefstr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ClickerMonkey%2Frefstr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ClickerMonkey%2Frefstr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ClickerMonkey","download_url":"https://codeload.github.com/ClickerMonkey/refstr/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244945597,"owners_count":20536295,"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":"2024-10-14T04:44:30.614Z","updated_at":"2025-03-22T10:39:16.941Z","avatar_url":"https://github.com/ClickerMonkey.png","language":"Go","readme":"# refstr\n\nA go module for converting between strings and any value AND referencing a path from a value through its structure to an end value and getting and setting it.\n\n**String Examples**:\n\n```go\n// A value already initialized\nx := 0\ne := refstr.Decode(\u0026x, \"45\")\n\n// Specify a type and string\nv, e := refstr.DecodeType(refstr.TypeOf[bool](), \"yes\")\n\n// A value not yet initialized\nvar y *int\ne := refstr.Decode(\u0026y, \"56\")\n\n// A slice\nvar z []float32\ne := refstr.Decode(\u0026z, \"[0.5 1 3.1415]\")\n\n// A map\nvar w map[string]int\ne := refstr.Decode(\u0026w, \"map[A:1 B:2 C:3]\")\n\n// A struct\ntype Point { X, Y float32 }\nvar p Point\ne := refstr.Decode(\u0026p, \"{X:4 Y:67}\")\n\n// Control how types are parsed further with your own decoder\ndec := refstr.NewDecoder()\ndec.Trues[\"yeppers\"] = struct{}{}\nvar b bool\ne := dec.Decode(\u0026b, \"yeppers\")\n\n```\n\nWith references you can follow a path of fields, maps, slice \u0026 array elements, and getter and setter functions to get and set a value. Once a set is done it can create all the elements in the path if they don't exist yet.\n\n**Reference Examples**:\n\n```go\ntype Name struct { First, Last string }\nfunc (n Name) Full() string { return n.Last + \", \" + n.First }\ntype Person struct { Name Name }\ntype Persons struct { ByName map[string]Person }\n\np := Persons{}\npref := refstr.NewRef(\u0026p)\n// references John's name in the map, but none of it exists yet.\njohnName := pref.Nexts([]any{\"ByName\", \"John\", \"Name\"})\n// creates john in the map and sets his first name\njohnName.Next(\"First\").Set(\"John\") \n// sets his last name\njohnName.Next(\"Last\").Set(\"Doe\")\n// gets his full name from the method Full()\nfull, _ := johnName.Next(\"Full\").Get()\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclickermonkey%2Frefstr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclickermonkey%2Frefstr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclickermonkey%2Frefstr/lists"}