{"id":18353164,"url":"https://github.com/daodao97/fly","last_synced_at":"2025-07-04T08:34:00.267Z","repository":{"id":37985421,"uuid":"471365221","full_name":"daodao97/fly","owner":"daodao97","description":"One easy-to-use go db library","archived":false,"fork":false,"pushed_at":"2023-07-26T06:58:49.000Z","size":51,"stargazers_count":81,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-06T11:46:21.626Z","etag":null,"topics":["go","golang","orm","sql"],"latest_commit_sha":null,"homepage":"https://daodao97.github.io/fly","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/daodao97.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":"2022-03-18T12:48:02.000Z","updated_at":"2024-05-08T10:01:02.000Z","dependencies_parsed_at":"2024-06-19T09:26:20.576Z","dependency_job_id":null,"html_url":"https://github.com/daodao97/fly","commit_stats":null,"previous_names":["daodao97/ggm"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/daodao97/fly","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daodao97%2Ffly","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daodao97%2Ffly/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daodao97%2Ffly/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daodao97%2Ffly/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daodao97","download_url":"https://codeload.github.com/daodao97/fly/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daodao97%2Ffly/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263476040,"owners_count":23472508,"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":["go","golang","orm","sql"],"created_at":"2024-11-05T21:38:45.256Z","updated_at":"2025-07-04T08:34:00.237Z","avatar_url":"https://github.com/daodao97.png","language":"Go","readme":"# FLY\n\n![](https://img.shields.io/badge/build-passing-brightgreen)\n![](https://img.shields.io/badge/coverage-%2066.2%25-red)\n![](https://img.shields.io/badge/license-MIT-blue)\n\nOne easy-to-use go db library  [简体中文](./README_zh.md), [Document](https://daodao97.github.io/fly)\n\n- data hook, Easy transition db data\n- sql builder, Not need handwritten SQL\n- hasOne/hasMany, Convenient get linked data\n- validator, Flexible verification policies\n- extensible, Easy extend custom hook/sql/validator\n- cacheEnable, Support for custom cache implementations\n\n# usages\n\nmore example please check out [model_test.go](./model_test.go)\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n\n    \"github.com/daodao97/fly\"\n    _ \"github.com/go-sql-driver/mysql\"\n)\n\nfunc init() {\n    err := fly.Init(map[string]*fly.Config{\n        \"default\": {DSN: \"root@tcp(127.0.0.1:3306)/fly_test?\u0026parseTime=true\"},\n    })\n    if err != nil {\n        panic(err)\n    }\n}\n\nfunc main() {\n    m := fly.New(\n        \"user\",\n        fly.ColumnHook(fly.CommaInt(\"role_id\"), fly.Json(\"profile\")),\n    )\n\n    var err error\n\n    _, err = m.Insert(map[string]interface{}{\n        \"name\": \"Seiya\",\n        \"profile\": map[string]interface{}{\n            \"hobby\": \"Pegasus Ryuseiken\",\n        },\n    })\n\n    var result []*User\n    err = m.Select(fly.WhereGt(\"id\", 1)).Binding(\u0026result)\n\n    var result1 *User\n    err = m.SelectOne(fly.WhereEq(\"id\", 1)).Binding(\u0026result1)\n\n    count, err := m.Count()\n    fmt.Println(\"count\", count)\n\n    _, err = m.Update(User{\n        ID:   1,\n        Name: \"星矢\",\n        Profile: \u0026Profile{\n            Hobby: \"天马流行拳\",\n        },\n        RoleIds: []int{2, 3},\n    })\n\n    _, err = m.Delete(fly.WhereEq(\"id\", 1))\n\n    fmt.Println(err)\n}\n\ntype User struct {\n    ID        int64    `db:\"id\"`\n    Name      string   `db:\"name\"`\n    Status    int64    `db:\"status\"`\n    Profile   *Profile `db:\"profile\"`\n    IsDeleted int      `db:\"is_deleted\"`\n    RoleIds   []int    `db:\"role_ids\"`\n    Score     int      `db:\"score\"`\n}\n\ntype Profile struct {\n    Hobby string `json:\"hobby\"`\n}\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaodao97%2Ffly","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaodao97%2Ffly","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaodao97%2Ffly/lists"}