{"id":13724360,"url":"https://github.com/fzerorubigd/goql","last_synced_at":"2025-04-13T09:41:03.426Z","repository":{"id":54599993,"uuid":"124893061","full_name":"fzerorubigd/goql","owner":"fzerorubigd","description":"A golang source code scanner, this time in sql :) ","archived":false,"fork":false,"pushed_at":"2018-10-13T14:12:11.000Z","size":210,"stargazers_count":302,"open_issues_count":7,"forks_count":13,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-03-27T01:11:13.043Z","etag":null,"topics":["ast","go","go-ast","golang","meta-programming","sql"],"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/fzerorubigd.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}},"created_at":"2018-03-12T13:26:36.000Z","updated_at":"2025-03-04T10:17:02.000Z","dependencies_parsed_at":"2022-08-13T21:00:27.370Z","dependency_job_id":null,"html_url":"https://github.com/fzerorubigd/goql","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/fzerorubigd%2Fgoql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fzerorubigd%2Fgoql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fzerorubigd%2Fgoql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fzerorubigd%2Fgoql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fzerorubigd","download_url":"https://codeload.github.com/fzerorubigd/goql/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248693344,"owners_count":21146779,"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":["ast","go","go-ast","golang","meta-programming","sql"],"created_at":"2024-08-03T01:01:55.598Z","updated_at":"2025-04-13T09:41:03.405Z","avatar_url":"https://github.com/fzerorubigd.png","language":"Go","funding_links":[],"categories":["Misc","Go"],"sub_categories":[],"readme":"# GoQL \nA query language, over Go code, in Go!\n\n[![Build Status](https://travis-ci.org/fzerorubigd/goql.svg)](https://travis-ci.org/fzerorubigd/goql)\n[![Coverage Status](https://coveralls.io/repos/github/fzerorubigd/goql/badge.svg?branch=master)](https://coveralls.io/github/fzerorubigd/goql?branch=master)\n[![GoDoc](https://godoc.org/github.com/fzerorubigd/goql?status.svg)](https://godoc.org/github.com/fzerorubigd/goql)\n[![Go Report Card](https://goreportcard.com/badge/github.com/fzerorubigd/goql/die-github-cache-die)](https://goreportcard.com/report/github.com/fzerorubigd/goql)\n\n*This package is under heavy development, anything may change!*\n\nThis is a golang sql driver, to interact with Go code. currently only select is possible, but the insert/update/delete is in todo list.\n\n## Usage \n\nlike any other sql driver in golang, just import the goql package in your code : \n\n```go\npackage main\n\nimport (\n\t\"database/sql\"\n\t\"fmt\"\n\t\"log\"\n\n\t_ \"github.com/fzerorubigd/goql\"\n\t\"github.com/fzerorubigd/goql/astdata\"\n)\n\nfunc main() {\n\t// open the net/http package\n\tcon, err := sql.Open(\"goql\", \"net/http\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer con.Close()\n\n\trows, err := con.Query(\"SELECT name, receiver, def FROM funcs\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfor rows.Next() {\n\t\tvar (\n\t\t\tname string\n\t\t\trec  sql.NullString\n\t\t\tdef  astdata.Definition\n\t\t)\n\t\trows.Scan(\u0026name, \u0026rec, \u0026def)\n\t\tif rec.Valid {\n\t\t\tname = rec.String + \".\" + name\n\t\t}\n\t\tfmt.Printf(\"\\nfunc %s , definition : %s\", name, def.String())\n\t}\n\n}\n\n```\n\nAlso there is an example command line is available for more advanced usage in `cmd/goql` by running `go get -u github.com/fzerorubigd/goql/...` the binary is available in your `GOBIN` directory. you can run query against any installed package in your `GOPATH` via this tool.\n\nList of supported tables and fields are available in [docs/table](docs/tables.md)\n\nthere is one special type called `definition`. this type is printed as string, but one can use functions to handle special queries. list of supported functions are available at [docs/functions](docs/functions.md) \n\nalso its possible to add new tables/fields/functions using plugins. an example plugin is available at [plugin/goqlimport](plugin/goqlimport/reg_import.go)\n\ncurrently only supported query is `select` , with `where`,`order` and `limit` some example query : \n\n\n```sql\nselect * from files where the docs is not null\nselect * from funcs where def = 'func()' and exported\nselect * from consts order by name desc limit 10, 10\nselect * from vars where is_struct(def) and name like 's%'\nselect * from types where is_map(def) and map_key(def) = 'string'\nselect * from imports where canonical = 'ctx'\n```\n\n## Demo \n\n[![asciicast](https://asciinema.org/a/170483.png)](https://asciinema.org/a/170483)\n\n## TODO\n\n- Write (more) documentation\n- UPDATE/INSERT/DELETE support (Yes, code generation with sql :) )\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffzerorubigd%2Fgoql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffzerorubigd%2Fgoql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffzerorubigd%2Fgoql/lists"}