Skip to content

Commit

Permalink
Mention the command line shell
Browse files Browse the repository at this point in the history
  • Loading branch information
asdine committed Nov 23, 2019
1 parent c67e91a commit dc72b6a
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ res, err := db.QueryRow(...)
Genji also supports structs as long as they implement the `record.Record` interface for writes and the `record.Scanner` interface for reads.
To simplify implementing these interfaces, Genji provides a command line tool that can generate methods for you.

First, install the Genji command line tool:

```bash
go get github.com/asdine/genji/cmd/genji
```

Declare a structure. Note that, even though struct tags are defined, Genji **doesn't use reflection** for these structures.

```go
Expand Down Expand Up @@ -271,3 +277,26 @@ func main() {
defer db.Close()
}
```

## Genji shell

Besides generating code, the genji command line provides an SQL shell that can be used to create, modify and consult Genji databases.

Make sure the Genji command line is installed:

```bash
go get github.com/asdine/genji/cmd/genji
```

Example:

```bash
# Opening an in-memory database:
genji

# Opening a BoltDB database:
genji my.db

# Opening a Badger database:
genji --badger pathToData
```

0 comments on commit dc72b6a

Please sign in to comment.