{"id":35165511,"url":"https://github.com/sehrgutesoftware/typevent","last_synced_at":"2026-04-29T02:09:42.091Z","repository":{"id":210191303,"uuid":"725964903","full_name":"sehrgutesoftware/typevent","owner":"sehrgutesoftware","description":"typevent provides type safe event channels for go/golang","archived":false,"fork":false,"pushed_at":"2023-12-06T11:18:39.000Z","size":13,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-28T06:39:01.198Z","etag":null,"topics":["eventbus","events","go","golang","pubsub","redis"],"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/sehrgutesoftware.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-12-01T08:43:13.000Z","updated_at":"2024-04-28T06:39:01.199Z","dependencies_parsed_at":"2023-12-06T12:30:40.454Z","dependency_job_id":"ec3b03eb-9173-4b7d-8e5b-d3116d912931","html_url":"https://github.com/sehrgutesoftware/typevent","commit_stats":null,"previous_names":["sehrgutesoftware/typevent"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/sehrgutesoftware/typevent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sehrgutesoftware%2Ftypevent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sehrgutesoftware%2Ftypevent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sehrgutesoftware%2Ftypevent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sehrgutesoftware%2Ftypevent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sehrgutesoftware","download_url":"https://codeload.github.com/sehrgutesoftware/typevent/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sehrgutesoftware%2Ftypevent/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32407184,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T19:38:08.556Z","status":"online","status_checked_at":"2026-04-29T02:00:06.602Z","response_time":110,"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":["eventbus","events","go","golang","pubsub","redis"],"created_at":"2025-12-28T19:29:47.092Z","updated_at":"2026-04-29T02:09:42.085Z","avatar_url":"https://github.com/sehrgutesoftware.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# typevent\n\n[![Unit Tests](https://github.com/sehrgutesoftware/typevent/actions/workflows/test.yml/badge.svg)](https://github.com/sehrgutesoftware/typevent/actions/workflows/test.yml)\n[![Go Reference](https://pkg.go.dev/badge/github.com/sehrgutesoftware/typevent.svg)](https://pkg.go.dev/github.com/sehrgutesoftware/typevent)\n\ntypevent provides type-safe event messaging channels for Go. They can be used to implement Pub/Sub schemes without the need for type assertions, streamlining the application code that uses the event channels.\n\nAt the core it consists of a generic `Channel` interface with the following methods:\n\n```go\ntype Channel[E Event] interface {\n    // Emit emits an event of type E on the channel.\n    Emit(E) error\n    // Subscribe registers a handler for events of type E on the channel.\n    Subscribe(ctx context.Context, handler Handler[E]) (Subscription, error)\n}\n```\n\nThe package currently provides one implementation of the interface, using [Redis Pub/Sub](https://redis.io/docs/interact/pubsub/) as the backing distribution system. Usage can look as follows:\n\n```go\nimport (\n    \"context\"\n    \"fmt\"\n\n    redisclient \"github.com/redis/go-redis/v9\"\n    \"github.com/sehrgutesoftware/typevent/redis\"\n)\n\nfunc ExampleNewChannel() {\n    type event string\n\n    // Create a new channel using redis Pub/Sub as the underlying event bus.\n    client := redisclient.NewClient(\u0026redisclient.Options{Addr: \"localhost:6379\"})\n\n    // conf holds the redis client used by the channel\n    conf := redis.NewConfig(client)\n\n    // This is where we create the channel that can be used to emit and subscribe to events\n    channel := redis.NewChannel[event](conf, \"CHANNEL_NAME\")\n\n    // Register a subscriber for the channel.\n    sub, _ := channel.Subscribe(context.Background(), func(ctx context.Context, ev event) error {\n        fmt.Printf(\"subscriber says: %s\\n\", ev)\n        return nil\n    })\n    defer sub.Close()\n\n    // Emit an event on the channel.\n    channel.Emit(\"Hello World!\")\n}\n\n```\n\n## Development\n### Run Tests\n```sh\ngo test ./...\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsehrgutesoftware%2Ftypevent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsehrgutesoftware%2Ftypevent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsehrgutesoftware%2Ftypevent/lists"}