{"id":22643212,"url":"https://github.com/hochfrequenz/go-bo4e","last_synced_at":"2026-01-16T06:21:53.432Z","repository":{"id":37097877,"uuid":"388728158","full_name":"Hochfrequenz/go-bo4e","owner":"Hochfrequenz","description":"BO4E Implementation in Go","archived":false,"fork":false,"pushed_at":"2025-04-08T06:50:21.000Z","size":9278,"stargazers_count":6,"open_issues_count":11,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-09T09:44:55.266Z","etag":null,"topics":["bo4e","energiewirtschaft"],"latest_commit_sha":null,"homepage":"","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/Hochfrequenz.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-07-23T08:15:29.000Z","updated_at":"2025-04-08T05:17:08.000Z","dependencies_parsed_at":"2024-01-08T11:16:22.247Z","dependency_job_id":"c90b655e-9616-4a02-8199-4fa0fb1c1587","html_url":"https://github.com/Hochfrequenz/go-bo4e","commit_stats":null,"previous_names":[],"tags_count":131,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hochfrequenz%2Fgo-bo4e","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hochfrequenz%2Fgo-bo4e/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hochfrequenz%2Fgo-bo4e/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hochfrequenz%2Fgo-bo4e/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Hochfrequenz","download_url":"https://codeload.github.com/Hochfrequenz/go-bo4e/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248493496,"owners_count":21113270,"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":["bo4e","energiewirtschaft"],"created_at":"2024-12-09T05:09:41.934Z","updated_at":"2026-01-16T06:21:53.420Z","avatar_url":"https://github.com/Hochfrequenz.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-bo4e\n\n![Unittest status badge](https://github.com/Hochfrequenz/go-bo4e/workflows/Unittests/badge.svg)\n![Coverage status badge](https://github.com/Hochfrequenz/go-bo4e/workflows/coverage/badge.svg)\n![Linter status badge](https://github.com/Hochfrequenz/go-bo4e/workflows/golangci-lint/badge.svg)\n[![Go Report Card](https://goreportcard.com/badge/github.com/Hochfrequenz/go-bo4e)](https://goreportcard.com/report/github.com/Hochfrequenz/go-bo4e)\n[![Go Reference](https://pkg.go.dev/badge/github.com/hochfrequenz/go-bo4e.svg)](https://pkg.go.dev/github.com/hochfrequenz/go-bo4e)\n\n**B**usiness **O**bjects for **E**nergy ([BO4E](https://www.bo4e.de/)) Implementation in Go. Highlights are\n\n- includes `json` tags for easy (un)marshalling\n- comes with builtin [validator](https://github.com/go-playground/validator) logic\n- is linted and has decent test coverage\n\n## Installation\n\n```\ngo get github.com/hochfrequenz/go-bo4e\n```\n\n## Minimal Working Example\n\n```go\npackage main\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"github.com/go-playground/validator/v10\"\n\t\"github.com/hochfrequenz/go-bo4e/bo\"\n\t\"github.com/hochfrequenz/go-bo4e/com\"\n\t\"github.com/hochfrequenz/go-bo4e/enum/botyp\"\n\t\"github.com/hochfrequenz/go-bo4e/enum/landescode\"\n\t\"github.com/hochfrequenz/go-bo4e/enum/sparte\"\n)\n\nfunc main() {\n\tmelo := bo.Messlokation{\n\t\tGeschaeftsobjekt: bo.Geschaeftsobjekt{\n\t\t\tBoTyp:             botyp.MESSLOKATION,\n\t\t\tVersionStruktur:   \"1\",\n\t\t\tExterneReferenzen: nil,\n\t\t},\n\t\tMesslokationsId: \"DE0000011111222223333344444555556\",\n\t\tSparte:          sparte.STROM,\n\t\tMessadresse: \u0026com.Adresse{\n\t\t\tPostleitzahl: \"82031\",\n\t\t\tOrt:          \"Grünwald\",\n\t\t\tStrasse:      \"Nördliche Münchner Straße\",\n\t\t\tHausnummer:   \"27A\",\n\t\t\tLandescode:   landescode.DE,\n\t\t},\n\t}\n\tvali := validator.New()\n\terr := vali.Struct(melo)\n\tif err == nil {\n\t\tfmt.Println(\"The MeLo is valid.\")\n\t}\n\tmeloBytes, err := json.Marshal(melo)\n\tmeloJson := string(meloBytes)\n\tfmt.Print(meloJson)\n}\n```\n\n[Use this in the Go Playground](https://play.golang.org/p/wq8B_31Odni).\n\n## Caveats\n\nWhen serializing decimals (e.g. `Zaehlwerk.Wandlerfaktor`) you'll notice that the decimals are by default serialized as\nstrings\n\n```json\n{\n  \"wandlerfaktor\": \"0.8\"\n}\n```\n\ninstead of a number like\n\n```json\n{\n  \"wandlerfaktor\": 0.8\n}\n```\n\nThis is the default behaviour defined in\nthe [decimal package](https://github.com/shopspring/decimal/blob/fa3b22f4d484d626ee81919285cf3d22ad3a4000/decimal.go#L47)\n. You can change the behaviour by setting\n\n```go\ndecimal.MarshalJSONWithoutQuotes = true\n```\n\nas described f.e. in [issue 21 there](https://github.com/shopspring/decimal/issues/21).\n\n## Other Noteworthy BO4E Implementations\n\n- [C# / .NET](https://github.com/Hochfrequenz/BO4E-dotnet/)\n- [Python](https://github.com/Hochfrequenz/BO4E-python/)\n- [Kotlin](https://github.com/openEnWi/ktBO4E-lib)\n- [TypeScript](https://github.com/openEnWi/tsBO4E-lib) (handcrafted)\n- [TypeScript](https://github.com/Hochfrequenz/bo4e-dotnet-ts-models) (autogenerated from C# lib)\n\n## Contributing\n\nContributions are welcome. Feel free to open a Pull Request against the main branch of this repository. Please provide\nunit tests if you contribute logic beyond bare business object definitions. We do track our modification proposals\nto the official BO4E standard in a separate\nrepository: [BO4E-modification-proposals](https://github.com/Hochfrequenz/bo4e-modification-proposals).\n\n### Adding Enums\n\nWhen adding Enums there are two packages ([stringer](https://pkg.go.dev/golang.org/x/tools/cmd/stringer)\n, [jsonenums](https://github.com/campoy/jsonenums)) needed to go-generate additional files, which contain an\nimplementation of the `fmt.Stringer` and `json.Marshaler` interface for the respective enum. Since they are just needed\nfor the code generation, but not a real dependency we don't want them in the go.mod file. One way to install them is\noutside of your directory with:\n\n```\ngo install github.com/campoy/jsonenums@latest\ngo install golang.org/x/tools/cmd/stringer@latest\n```\n\n## Hochfrequenz\n\n[Hochfrequenz Unternehmensberatung GmbH](https://www.hochfrequenz.de) is a Grünwald (near Munich) based consulting\ncompany with offices in Berlin and Bremen. We're not only the main contributor to open source BO4E software but,\naccording to [Kununu ratings](https://www.kununu.com/de/hochfrequenz-unternehmensberatung1), also among the most\nattractive employers within the German energy market. Applications of talented developers are welcome at any time!\nPlease consider visiting\nour [career page](https://www.hochfrequenz.de/index.php/karriere/aktuelle-stellenausschreibungen/full-stack-entwickler) (\nGerman only).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhochfrequenz%2Fgo-bo4e","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhochfrequenz%2Fgo-bo4e","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhochfrequenz%2Fgo-bo4e/lists"}