{"id":20936058,"url":"https://github.com/coc1961/flow","last_synced_at":"2026-05-21T03:02:25.722Z","repository":{"id":83822464,"uuid":"224467266","full_name":"coc1961/flow","owner":"coc1961","description":"Simple Golang Flow Framework","archived":false,"fork":false,"pushed_at":"2019-12-29T00:30:49.000Z","size":19,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-13T02:43:28.310Z","etag":null,"topics":["flow","framwework","go","golang"],"latest_commit_sha":null,"homepage":"","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/coc1961.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-27T16:00:59.000Z","updated_at":"2024-08-29T18:51:58.000Z","dependencies_parsed_at":"2023-06-19T16:19:30.334Z","dependency_job_id":null,"html_url":"https://github.com/coc1961/flow","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/coc1961/flow","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coc1961%2Fflow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coc1961%2Fflow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coc1961%2Fflow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coc1961%2Fflow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coc1961","download_url":"https://codeload.github.com/coc1961/flow/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coc1961%2Fflow/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33286665,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-21T02:57:32.698Z","status":"ssl_error","status_checked_at":"2026-05-21T02:57:31.990Z","response_time":62,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["flow","framwework","go","golang"],"created_at":"2024-11-18T22:17:46.631Z","updated_at":"2026-05-21T03:02:25.687Z","avatar_url":"https://github.com/coc1961.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flow\n\nSimple framework to design workflows based on processes connected through channels.\n\n\u003e Each process has an input channel and an output channel,the output channel is the input channel of the next process.\n\n\u003e Each process is responsible for closing the output channel when no more information will be sent.\n\n\u003e  Each process will process the data received from its input channel until the end of the data.\n\n\u003e Each created process can be reused in other flows\n\nCreating a Process:\n\n```go\ntype Summarizer struct {\n}\n\nfunc (p Summarizer) Process(input flow.Chan, output flow.Chan, ctx flow.Context) {\n    //Cast input and output channels\n    in := input.(chan int)\n    out := output.(chan int)\n\n    //I close the output channel, when no more data to send\n    defer close(out)\n\n\n    //I add the input values ​​and accumulate the total\n    tot:=0\n    for {\n        num, ok := \u003c-in\n        if !ok {\n            break\n        }\n        tot += nuk\n    }\n\n    //Send the total to the output channel\n    out \u003c- tot\n\n}\n```\n\nCreating a Flow\n\n```go\n    // I create the flow with an instance of Process.\n    // The input channel of the flow.\n    // The output channel of the flow\n    fl := flow.New(Summarizer{}, make(chan int, 0))\n\n    // I create the flow data input channel\n    input := make(chan string, 1)\n\n    ctx := flow.Context{}\n\n    //Start the flow\n    outChan := fl.Start(input, ctx)\n```\n\nUsing the Flow\n\n```go\n    //Send data to the flow\n    input \u003c- 10\n    input \u003c- 20\n    input \u003c- 30\n    input \u003c- 40\n\n    //No more data to send, I close the channel\n    close(input)\n\n    //Cast the flow outflow and get the result\n    out := outChan.(chan int)\n    total := \u003c-out\n    fmt.Println(total)\n\n    //Printed Result is\n    100\n```\n\nAdding Processes to the Flow\n\n```go\n    // I create the flow with an instance of Process.\n    // The input channel of the flow.\n    // The output channel of the flow\n    fl := flow.New(Summarizer{}, input, make(chan int, 0))\n\n    // I add a new process to the flow ToString\n    // This process has as input channel the output channel of Summarizer\n    // The output channel of the ToString process is of type string\n    // This process takes the Summarize total and transforms it into a string\n    fl.Add(ToString{}, make(chan string, 0))\n\n    // I create the flow data input channel\n    input := make(chan string, 1)\n\n    ctx := flow.Context{}\n\n   //Start the flow\n    outChan := fl.Start(input, ctx)\n\n    // I execute the flow and now the total 100 number is transformed into a string as shown below\n\n    //Cast the flow outflow and get the result\n    out := outChan.(chan string)\n    total := \u003c-out\n    fmt.Println(total)\n\n    //Printed Result is\n    \"The Total is : 100\"\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoc1961%2Fflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoc1961%2Fflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoc1961%2Fflow/lists"}