chabashira

command module
v0.0.0-...-eef95f7 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2015 License: MIT Imports: 12 Imported by: 0

README

Chabashira

Simple bridge tool between genmai and ridgepole.

Dependency

Installlation

go install github.com/Talos208/chabashira

Schema

It's based on schema description of genmai.

// It isn't target.
type Hoge struct {
  ...
}

// It is target.
// db:"entity"
type Fuga struct {
  Id int64 `db:"pk"`       // Primary Key
  A  sql.NullInt64         // Nullable integer
  B  string `db:"unique"`  // varchar with Unique constraint
  C  string `limit:"30"`   // varchar(30)
  D  float `default:"1.0"` // Real with default value
  E  []byte                // Binary
  F  time.Time             // timestamp
  PiyoId int64 `refer:""`  // Reference to table "Piyo"
}

// It is target too.
// db:"entity"
type Piyo struct {
  Id int64 `db:"pk"`
  ...
}

Usage

chabashira <directory or file>

If specify file, process it. If specify path, process all .go files in sepcified directory. Chabashira collect schema information from struct which hava db:"entity" in it's comment. Then generates Rails's migration format file. Like this.

create_table 'fuga' do |t|
  t.integer :a
  t.string :b, unique:true, null:false
  t.string :c, null:false
  t.float :d, null:false
  t.binary :e
  t.timestamp :f, null:false
  t.references :piyo
end

create_table 'piyo' do |t|
  ...
end

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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