Skip to content

Commit

Permalink
Rename repository (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
ginokent authored Feb 8, 2021
1 parent 4b29c1e commit 843a015
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
COMMAND_NAME := bqtableschema
COMMAND_NAME := bqschema-gen
COMMIT_HASH := $(shell git rev-parse HEAD)
ROOT_DIR := $(shell git rev-parse --show-toplevel)
MAIN_DIR := ${ROOT_DIR}
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# bqtableschema
# bqschema-gen-go

BigQuery table schema struct generator
BigQuery table schema Go struct generator

[![main](https://github.com/djeeno/bqtableschema/workflows/main/badge.svg)](https://github.com/djeeno/bqtableschema/tree/main)
[![codecov](https://codecov.io/gh/djeeno/bqtableschema/branch/main/graph/badge.svg)](https://codecov.io/gh/djeeno/bqtableschema)
[![main](https://github.com/djeeno/bqschema-gen-go/workflows/main/badge.svg)](https://github.com/djeeno/bqschema-gen-go/tree/main)
[![codecov](https://codecov.io/gh/djeeno/bqschema-gen-go/branch/main/graph/badge.svg)](https://codecov.io/gh/djeeno/bqschema-gen-go)

## generate

Expand All @@ -12,9 +12,9 @@ BigQuery table schema struct generator
```bash
cd /path/to/your/golang-project-repository

# Create a directory where bqtableschema will generate the code.
mkdir -p bqtableschema
cd bqtableschema
# Create a directory where bqschema-gen-go will generate the code.
mkdir -p bqschema
cd bqschema

# Set the required environment variables.
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/serviceaccount/keyfile.json
Expand All @@ -23,20 +23,20 @@ export GCLOUD_PROJECT_ID=bigquery-public-data
# Set BigQuery Dataset name ref. https://console.cloud.google.com/bigquery?p=bigquery-public-data&d=hacker_news&page=dataset
export BIGQUERY_DATASET=hacker_news
# Set output file
export OUTPUT_FILE=bqtableschema.generated.go
export OUTPUT_FILE=bqschema.generated.go

# generate
go run github.com/djeeno/bqtableschema
go run github.com/djeeno/bqschema-gen-go
```

Example generated file content:

```go
// Code generated by go run github.com/djeeno/bqtableschema; DO NOT EDIT.
// Code generated by go run github.com/djeeno/bqschema-gen-go; DO NOT EDIT.

//go:generate go run github.com/djeeno/bqtableschema
//go:generate go run github.com/djeeno/bqschema-gen-go

package bqtableschema
package bqschema

import "time"

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/djeeno/bqtableschema
module github.com/djeeno/bqschema-gen-go

go 1.15

Expand Down
10 changes: 5 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:generate go run github.com/djeeno/bqtableschema
//go:generate go run github.com/djeeno/bqschema-gen-go

package main

Expand Down Expand Up @@ -34,7 +34,7 @@ const (
envNameOutputFile = "OUTPUT_FILE"
// defaultValue
defaultValueEmpty = ""
defaultValueOutputFile = "bqtableschema.generated.go"
defaultValueOutputFile = "bqschema.generated.go"
)

var (
Expand Down Expand Up @@ -116,11 +116,11 @@ func Run(ctx context.Context) (err error) {

func Generate(ctx context.Context, client *bigquery.Client, dataset string) (generatedCode []byte, err error) {

const head = `// Code generated by go run github.com/djeeno/bqtableschema; DO NOT EDIT.
const head = `// Code generated by go run github.com/djeeno/bqschema-gen-go; DO NOT EDIT.
//go:generate go run github.com/djeeno/bqtableschema
//go:generate go run github.com/djeeno/bqschema-gen-go
package bqtableschema
package bqschema
`

Expand Down
2 changes: 1 addition & 1 deletion main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ func Test_generateTableSchemaCode(t *testing.T) {
t.Error(err)
}
// NOTE(djeeno): ここまで来たら、確認したいことは確認済み。
// ref. https://github.com/djeeno/bqtableschema/blob/260524ce0ae2dd5bdcbdd57446cdd8c140326ca4/main.go#L212
// ref. https://github.com/djeeno/bqschema-gen-go/blob/260524ce0ae2dd5bdcbdd57446cdd8c140326ca4/main.go#L212
return
}
}
Expand Down
2 changes: 1 addition & 1 deletion tools/generatewalker.bash
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
set -E -e -o pipefail

grep "^\t*//go:generate go run github.com/djeeno/bqtableschema" -r "$(pwd)" -l | xargs -I{} bash -cx "go generate {}"
grep "^\t*//go:generate go run github.com/djeeno/bqschema-gen-go" -r "$(pwd)" -l | xargs -I{} bash -cx "go generate {}"

0 comments on commit 843a015

Please sign in to comment.