{"id":28003158,"url":"https://github.com/fnproject/flow-lib-go","last_synced_at":"2025-08-19T19:18:43.948Z","repository":{"id":57498562,"uuid":"105857484","full_name":"fnproject/flow-lib-go","owner":"fnproject","description":"Workflow orchestration for your Go functions using Fn Flow","archived":false,"fork":false,"pushed_at":"2023-10-11T20:54:12.000Z","size":26118,"stargazers_count":10,"open_issues_count":3,"forks_count":4,"subscribers_count":34,"default_branch":"master","last_synced_at":"2025-05-09T01:59:10.115Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fnproject.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-05T06:41:10.000Z","updated_at":"2024-11-12T08:46:21.000Z","dependencies_parsed_at":"2024-06-20T21:57:19.356Z","dependency_job_id":"aa642b5a-de6d-4df4-b20f-93a0dbd70160","html_url":"https://github.com/fnproject/flow-lib-go","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnproject%2Fflow-lib-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnproject%2Fflow-lib-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnproject%2Fflow-lib-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnproject%2Fflow-lib-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fnproject","download_url":"https://codeload.github.com/fnproject/flow-lib-go/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253176436,"owners_count":21866142,"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-05-09T01:59:14.787Z","updated_at":"2025-05-09T01:59:15.458Z","avatar_url":"https://github.com/fnproject.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Serverless Workflows with Go\nEasily create serverless workflows directly in Go with the power of [Fn Flow](https://github.com/fnproject/flow).\n\n## Quick Intro\nSimply import this library into your go function, build and deploy onto Fn. Flows use the [fdk-go](https://github.com/fnproject/fdk-go) to handle interacting with Fn, below is an example flow:\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"time\"\n\n  \tfdk \"github.com/fnproject/fdk-go\"\n  \tflows \"github.com/fnproject/flow-lib-go\"\n)\n\nfunc init() {\n  \tflows.RegisterAction(strings.ToUpper)\n  \tflows.RegisterAction(strings.ToLower)\n}\n\nfunc main() {\n\tfdk.Handle(flows.WithFlow(\n    \t\tfdk.HandlerFunc(func(ctx context.Context, r io.Reader, w io.Writer) {\n      \t\t\tcf := flows.CurrentFlow().CompletedValue(\"foo\")\n      \t\t\tvalueCh, errorCh := cf.ThenApply(strings.ToUpper).ThenApply(strings.ToLower).Get()\n      \t\t\tselect {\n      \t\t\tcase value := \u003c-valueCh:\n        \t\t\tfmt.Fprintf(w, \"Flow succeeded with value %v\", value)\n      \t\t\tcase err := \u003c-errorCh:\n        \t\t\tfmt.Fprintf(w, \"Flow failed with error %v\", err)\n      \t\t\tcase \u003c-time.After(time.Minute * 1):\n        \t\t\tfmt.Fprintf(w, \"Timed out!\")\n      \t\t\t}\n    \t\t}),\n  \t)\n}\n```\n\n## Where do I go from here?\n\nA variety of example use-cases is provided [here](examples/hello-flow/README.md).\n\n## FAQs\n\n### How are values serialized?\n\nGo's [gob](https://golang.org/pkg/encoding/gob/) serialization mechanism is used to encode/decode values for communication with the completer.\n\n### What kinds of values can be serialized?\n\nBooleans, string, structs, arrays and slices are supported. Functions, closures and channels are not.\n\n### How are continuations serialized?\n\nSince Go does not support [serializing closures/functions](https://github.com/golang/go/issues/5514) due to its statically compiled nature, they are in fact not serialized at all. Go functions implementing a continuation need to be explicitly registered by calling `flows.RegisterAction(actionFunction)` typically inside the handler's _init_ function. Registering actions assigns a unique and stable key that can be serialized and used to look up a pointer to the function during a continuation invocation.\n\n### Why do actions need to be registered?\n\nSee above.\n\n### Can I use closures or method receivers in my continuations?\n\nNo. Only continuation actions implemented with functions are supported, since they are stateless. No state will be serialized with a continuation. Although possible, invoking a method receiver is not currently supported inside continuations.\n\n### How does error-handling work?\n\nGo allows functions to return error types in addition to a result via its support for multiple return values. If a continuation function returns a (non-nil) error as its second return value, its error message will be serialized and form the failed value of that stage.\n\nIf a panic occurs while invoking the continuation function, the panic value will be captured and the stage failed with the same value.\n\n### Can I invoke other fn functions?\n\nYes. `flows.CurrentFlow().InvokeFunction(\"your_function_id\", req)`, where the function ID is a value like `01CQV4NEGMNG8G00GZJ0000002` and can be resolved with the following command:\n```\nfn inspect function your_app your_function | grep fnproject.io/fn/invokeEndpoint\n```\nSee [here](examples/hello-flow/func.go) for a full example.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffnproject%2Fflow-lib-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffnproject%2Fflow-lib-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffnproject%2Fflow-lib-go/lists"}