railstack/go-on-rails

View on GitHub
lib/generators/USAGE

Summary

Maintainability
Test Coverage
Description:
    Generate Golang app by Rails models: use Rails as a modeling and migration tool to build a Golang app, or migrate some of existed Rails APIs to Golang to decouple and high-perform your services.

    Read more: https://github.com/railstack/go-on-rails


Example:
    rails generate gor development -m user post

    Here are valid ENV_NAME arguments by default for a Rails generated database configuration by default: [dev, development, pro, production, test]. The default ENV_NAME is "development" if you omit one. Obviously, you can reconfig the config/database.yml to define your own environments.

    So you can also run:

    rails g gor dev -m user post

    This will mainly create:
        go_app/Dockerfile
        go_app/Makefile
        go_app/main.go
        go_app/models/doc/models.html
        go_app/models/db.go
        go_app/models/gor_user.go
        go_app/models/gor_post.go

    Notice: If you omit the -m option, all the models of the Rails app will be generated.

    If you omit all the options, just run:

    rails g gor

    This will generate code of all the models with the database connection in Rails development environment configuration.