{"id":34602025,"url":"https://github.com/xxxsen/picker","last_synced_at":"2026-06-01T09:31:09.410Z","repository":{"id":287215235,"uuid":"963984264","full_name":"xxxsen/picker","owner":"xxxsen","description":"plugin container","archived":false,"fork":false,"pushed_at":"2025-10-04T11:20:11.000Z","size":52,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-04T13:18:35.836Z","etag":null,"topics":["dynamic","plugin","script","yaegi"],"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/xxxsen.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-04-10T14:08:35.000Z","updated_at":"2025-10-04T11:19:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"7f939c23-3745-470b-8f90-6b3d0cb5e0f8","html_url":"https://github.com/xxxsen/picker","commit_stats":null,"previous_names":["xxxsen/picker"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/xxxsen/picker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xxxsen%2Fpicker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xxxsen%2Fpicker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xxxsen%2Fpicker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xxxsen%2Fpicker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xxxsen","download_url":"https://codeload.github.com/xxxsen/picker/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xxxsen%2Fpicker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33769490,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-01T02:00:06.963Z","response_time":115,"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":["dynamic","plugin","script","yaegi"],"created_at":"2025-12-24T12:52:43.961Z","updated_at":"2026-06-01T09:31:09.406Z","avatar_url":"https://github.com/xxxsen.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"picker\n===\n\n一个基于 [yaegi](https://github.com/traefik/yaegi) 的轻量插件容器，支持在运行时按配置加载并执行 Go 函数。\n\n目前内置 YAML / JSON / TOML 三种配置格式。推荐在 TOML 中使用 `'''` 多行字面量存放函数体，可避免 `\\n` 这类转义在解析过程中被处理。\n\n## Quick Start\n\n更多示例见 `picker_test.go`。\n\n```go\npackage main\n\nimport (\n    \"context\"\n    \"log\"\n\n    \"github.com/xxxsen/picker\"\n)\n\nfunc main() {\n    pgs := \u0026picker.Plugins{\n        Plugins: []*picker.PluginConfig{\n            {\n                Name:     \"p1\",\n                Function: `func(ctx context.Context) {fmt.Println(\"hello world\")}`,\n            },\n            {\n                Name:     \"p2\",\n                Import:   []string{\"fmt\"},\n                Function: `func(ctx context.Context) {fmt.Println(\"hello again\")}`,\n            },\n            {\n                Name:   \"p3\",\n                Define: \"a := 3.14\",\n                Function: `func(ctx context.Context) {fmt.Printf(\"value a:%f\\n\", a)}`,\n            },\n        },\n    }\n    pk, err := picker.Load[func(context.Context)](pgs)\n    if err != nil {\n        log.Fatalf(\"load plugins failed: %v\", err)\n    }\n    for _, name := range pk.List() {\n        fn, _ := pk.Get(name)\n        fn(context.Background())\n    }\n}\n```\n\n\u003e 提示：泛型参数决定了插件函数签名，确保配置中的函数类型与之匹配即可；参数数量、类型都可以自行定义。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxxxsen%2Fpicker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxxxsen%2Fpicker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxxxsen%2Fpicker/lists"}