gitquery

package module
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2017 License: MIT Imports: 6 Imported by: 2

README

gitquery

codebeat badge

Build Status

codecov

GoDoc

Installation

Check the Releases page to download the gitquery binary.

Usage

Usage:
  gitquery [OPTIONS] <query | shell | version>

Help Options:
  -h, --help  Show this help message

Available commands:
  query    Execute a SQL query a repository.
  shell    Start an interactive session.
  version  Show the version information.

For example:

$ cd my_git_repo
$ gitquery query 'SELECT hash, author_email, author_name FROM commits LIMIT 2;' 
SELECT hash, author_email, author_name FROM commits LIMIT 2;
+------------------------------------------+---------------------+-----------------------+
|                   HASH                   |    AUTHOR EMAIL     |      AUTHOR NAME      |
+------------------------------------------+---------------------+-----------------------+
| 003dc36e0067b25333cb5d3a5ccc31fd028a1c83 | user1@test.io       | Santiago M. Mola      |
| 01ace9e4d144aaeb50eb630fed993375609bcf55 | user2@test.io       | Antonio Navarro Perez |
+------------------------------------------+---------------------+-----------------------+

You can use the interactive shell like you usually do to explore tables in postgreSQL per example:

$ gitquery shell

           gitQL SHELL
           -----------
You must end your queries with ';'

!> SELECT hash, author_email, author_name FROM commits LIMIT 2;

--> Executing query: SELECT hash, author_email, author_name FROM commits LIMIT 2;

+------------------------------------------+---------------------+-----------------------+
|                   HASH                   |    AUTHOR EMAIL     |      AUTHOR NAME      |
+------------------------------------------+---------------------+-----------------------+
| 003dc36e0067b25333cb5d3a5ccc31fd028a1c83 | user1@test.io       | Santiago M. Mola      |
| 01ace9e4d144aaeb50eb630fed993375609bcf55 | user2@test.io       | Antonio Navarro Perez |
+------------------------------------------+---------------------+-----------------------+
!>  

Tables

gitquery exposes the following tables:

Name Columns
commits hash, author_name, author_email, author_time, comitter_name, comitter_email, comitter_time, message
blobs hash, size
refs name, type, hash, target, is_branch, is_note, is_remote, is_tag
tags hash, name, tagger_email, tagger_name, tagger_when, message, target
tree_entries tree_hash, entry_hash, mode, name

SQL syntax

We are continuously adding more functionality to gitquery. We support a subset of the SQL standard, currently including:

Supported
Comparison expressions !=, ==, >, <, >=,<=
Grouping expressions COUNT, FIRST
Standard expressions ALIAS, LITERAL, STAR (*)
Statements CROSS JOIN, DESCRIBE, FILTER (WHERE), GROUP BY, LIMIT, SELECT, SHOW TABLES, SORT

License

gitquery is licensed under the MIT License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDatabase added in v0.6.0

func NewDatabase(name string, r *git.Repository) sql.Database

Types

type Database added in v0.6.0

type Database struct {
	// contains filtered or unexported fields
}

func (*Database) Name added in v0.6.0

func (d *Database) Name() string

func (*Database) Tables added in v0.6.0

func (d *Database) Tables() map[string]sql.Table

Directories

Path Synopsis
cmd
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL