All Projects → fzerorubigd → Goql

fzerorubigd / Goql

Licence: mit
A golang source code scanner, this time in sql :)

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Labels

Projects that are alternatives of or similar to Goql

Jsqlparser
JSqlParser parses an SQL statement and translate it into a hierarchy of Java classes. The generated hierarchy can be navigated using the Visitor Pattern
Stars: ✭ 3,405 (+1054.24%)
Mutual labels:  ast, sql
Gorm2sql
auto generate sql from gorm model struct
Stars: ✭ 92 (-68.81%)
Mutual labels:  ast, sql
Qone
Next-generation web query language, extend .NET LINQ for javascript.
Stars: ✭ 463 (+56.95%)
Mutual labels:  ast, sql
Gitbase
SQL interface to git repositories, written in Go. https://docs.sourced.tech/gitbase
Stars: ✭ 1,955 (+562.71%)
Mutual labels:  ast, sql
Sql Composer
Standalone SQL composer DSL for Ruby
Stars: ✭ 26 (-91.19%)
Mutual labels:  ast, sql
Flora Sql Parser
Parse SQL (select) statements into abstract syntax tree (AST) and convert ASTs back to SQL.
Stars: ✭ 186 (-36.95%)
Mutual labels:  ast, sql
Decorator
Function decorators for Elixir
Stars: ✭ 278 (-5.76%)
Mutual labels:  ast
Android Nosql
Lightweight, simple structured NoSQL database for Android
Stars: ✭ 284 (-3.73%)
Mutual labels:  sql
Shiba
Catch bad SQL queries before they cause problems in production
Stars: ✭ 277 (-6.1%)
Mutual labels:  sql
Quaint
SQL Query AST and Visitor for Rust
Stars: ✭ 272 (-7.8%)
Mutual labels:  sql
Requery
requery - modern SQL based query & persistence for Java / Kotlin / Android
Stars: ✭ 3,071 (+941.02%)
Mutual labels:  sql
Crate
CrateDB is a distributed SQL database that makes it simple to store and analyze massive amounts of data in real-time.
Stars: ✭ 3,254 (+1003.05%)
Mutual labels:  sql
Sq
swiss-army knife for data
Stars: ✭ 275 (-6.78%)
Mutual labels:  sql
Trino
Official repository of Trino, the distributed SQL query engine for big data, formerly known as PrestoSQL (https://trino.io)
Stars: ✭ 4,581 (+1452.88%)
Mutual labels:  sql
Protoc Gen Gotemplate
📂 generic protocol generator based on golang's text/template (grpc/protobuf)
Stars: ✭ 284 (-3.73%)
Mutual labels:  ast
Javacodeaudit
Getting started with java code auditing 代码审计入门的小项目
Stars: ✭ 289 (-2.03%)
Mutual labels:  sql
Blazer
Business intelligence made simple
Stars: ✭ 3,102 (+951.53%)
Mutual labels:  sql
Clojureql
ClojureQL is superior SQL integration for Clojure
Stars: ✭ 281 (-4.75%)
Mutual labels:  sql
Text2sql Data
A collection of datasets that pair questions with SQL queries.
Stars: ✭ 287 (-2.71%)
Mutual labels:  sql
Esmangle
esmangle is mangler / minifier for Mozilla Parser API AST
Stars: ✭ 282 (-4.41%)
Mutual labels:  ast

GoQL

A query language, over Go code, in Go!

Build Status Coverage Status GoDoc Go Report Card

This package is under heavy development, anything may change!

This is a golang sql driver, to interact with Go code. currently only select is possible, but the insert/update/delete is in todo list.

Usage

like any other sql driver in golang, just import the goql package in your code :

package main

import (
	"database/sql"
	"fmt"
	"log"

	_ "github.com/fzerorubigd/goql"
	"github.com/fzerorubigd/goql/astdata"
)

func main() {
	// open the net/http package
	con, err := sql.Open("goql", "net/http")
	if err != nil {
		log.Fatal(err)
	}
	defer con.Close()

	rows, err := con.Query("SELECT name, receiver, def FROM funcs")
	if err != nil {
		log.Fatal(err)
	}

	for rows.Next() {
		var (
			name string
			rec  sql.NullString
			def  astdata.Definition
		)
		rows.Scan(&name, &rec, &def)
		if rec.Valid {
			name = rec.String + "." + name
		}
		fmt.Printf("\nfunc %s , definition : %s", name, def.String())
	}

}

Also 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.

List of supported tables and fields are available in docs/table

there 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

also its possible to add new tables/fields/functions using plugins. an example plugin is available at plugin/goqlimport

currently only supported query is select , with where,order and limit some example query :

select * from files where the docs is not null
select * from funcs where def = 'func()' and exported
select * from consts order by name desc limit 10, 10
select * from vars where is_struct(def) and name like 's%'
select * from types where is_map(def) and map_key(def) = 'string'
select * from imports where canonical = 'ctx'

Demo

asciicast

TODO

  • Write (more) documentation
  • UPDATE/INSERT/DELETE support (Yes, code generation with sql :) )
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].