https://github.com/takashabe/bt-fixture
bt-fixture is a test-fixture management library for the cloud bigtable.
https://github.com/takashabe/bt-fixture
bigtable cloud-bigtable fixtures go golang
Last synced: 4 months ago
JSON representation
bt-fixture is a test-fixture management library for the cloud bigtable.
- Host: GitHub
- URL: https://github.com/takashabe/bt-fixture
- Owner: takashabe
- License: mit
- Created: 2018-05-10T13:20:26.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2023-02-25T01:55:02.000Z (over 3 years ago)
- Last Synced: 2025-08-14T00:37:18.620Z (11 months ago)
- Topics: bigtable, cloud-bigtable, fixtures, go, golang
- Language: Go
- Size: 39.1 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bt-fixture
bt-fixture is a test-fixture management library for the Cloud Bigtable.
[](https://godoc.org/github.com/takashabe/bt-fixture)
[](https://circleci.com/gh/takashabe/bt-fixture)
[](https://goreportcard.com/report/github.com/takashabe/bt-fixture)
Management the fixtures of the database for testing.
## Features
- Load the Cloud Bigtable columns fixture by a yaml file
- Before cleanup a table
- Types
- int and float types in a fixture convert to big-endian 8-byte values
## Usage
- Import `bt-fixture` package and setup a fixture file
```go
package main
import (
fixture "github.com/takashabe/bt-fixture"
)
func main() {
// omit the error handling
f, _ := fixture.New("test-project", "test-instance")
f.Load("testdata/fixture.yaml")
}
```
## Fixture file format
```yaml
table: person
column_families:
- family: d
columns:
- key: 1##a
rows:
name: a
age: 10
height: 140.0
version: 2018-05-19 00:00:00 +00:00
- key: 1##a
rows:
name: a
abe: 11
height: 140.0
version: 2019-05-19 00:00:00 +00:00
- family: e
columns:
- key: 2##b
rows:
name: b
age: 20
height: 180.0
version: 2018-05-19 00:00:00 +00:00
```
- Example output:
```
$cbt read person
----------------------------------------
1##a
d:age @ 2019/05/19-00:00:00.000000
"\x00\x00\x00\x00\x00\x00\x00\v"
d:age @ 2018/05/19-00:00:00.000000
"\x00\x00\x00\x00\x00\x00\x00\n"
d:height @ 2019/05/19-00:00:00.000000
"@a\x80\x00\x00\x00\x00\x00"
d:height @ 2018/05/19-00:00:00.000000
"@a\x80\x00\x00\x00\x00\x00"
d:name @ 2019/05/19-00:00:00.000000
"a"
d:name @ 2018/05/19-00:00:00.000000
"a"
----------------------------------------
2##b
e:age @ 2018/05/19-00:00:00.000000
"\x00\x00\x00\x00\x00\x00\x00\x14"
e:height @ 2018/05/19-00:00:00.000000
"@f\x80\x00\x00\x00\x00\x00"
e:name @ 2018/05/19-00:00:00.000000
"b"
```