All Projects → railstack → Go On Rails

railstack / Go On Rails

Licence: mit
🚄 Use Rails to Develop or Generate a Golang Application.

Programming Languages

ruby
36898 projects - #4 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Go On Rails

Laravel Code Generator
An intelligent code generator for Laravel framework that will save you time! This awesome tool will help you generate resources like views, controllers, routes, migrations, languages and/or form-requests! It is extremely flexible and customizable to cover many on the use cases. It is shipped with cross-browsers compatible template, along with a client-side validation to modernize your application.
Stars: ✭ 485 (+76.36%)
Mutual labels:  crud, generator, code-generator
Springbootcodegenerator
又名大狼狗代码生成器,基于SpringBoot2+Freemarker的JAVA代码生成器,以释放双手为目的,支持mysql/oracle/pgsql三大数据库, 用DDL-SQL语句生成JPA/JdbcTemplate/Mybatis/MybatisPlus/BeetlSQL等相关代码.
Stars: ✭ 810 (+194.55%)
Mutual labels:  crud, code-generator
Graphback
Graphback - Out of the box GraphQL server and client
Stars: ✭ 323 (+17.45%)
Mutual labels:  crud, generator
Evolutility Ui Jquery
Model-driven Web UI for CRUD using REST or localStorage.
Stars: ✭ 164 (-40.36%)
Mutual labels:  crud, code-generator
Swiftcolorgen
A tool that generate code for Swift projects, designed to improve the maintainability of UIColors
Stars: ✭ 152 (-44.73%)
Mutual labels:  generator, code-generator
Api Generator
PHP-code generator for Laravel framework, with complete support of JSON-API data format
Stars: ✭ 244 (-11.27%)
Mutual labels:  generator, code-generator
Typegraphql Prisma
Prisma 2 generator to emit TypeGraphQL types and CRUD resolvers from your Prisma 2 schema
Stars: ✭ 137 (-50.18%)
Mutual labels:  crud, generator
Cray
A Laravel package to help you generate nearly complete CRUD pages like crazy!
Stars: ✭ 108 (-60.73%)
Mutual labels:  crud, generator
Stator
Stator, your go-to template for the perfect stack. 😍🙏
Stars: ✭ 217 (-21.09%)
Mutual labels:  crud, generator
Crud Intellij Plugin
一个增删改查的idea插件,可以根据数据库表结构,帮助您快速生成model、dao、service、controller等相关代码。同时支持MyBatis、JPA、MybatisPlus。
Stars: ✭ 217 (-21.09%)
Mutual labels:  crud, code-generator
Ultra light wizard
No time to manage a wizard state machine, session variables, or complicated controllers? Use ultra light wizard!! A RESTful session-less validation-friendly simple multi-step form approach in Rails.
Stars: ✭ 35 (-87.27%)
Mutual labels:  rails, generator
Deep Copy
Deep copy generator
Stars: ✭ 82 (-70.18%)
Mutual labels:  generator, code-generator
Datamodel Code Generator
Pydantic model generator for easy conversion of JSON, OpenAPI, JSON Schema, and YAML data sources.
Stars: ✭ 393 (+42.91%)
Mutual labels:  generator, code-generator
Protoc Gen Gotemplate
📂 generic protocol generator based on golang's text/template (grpc/protobuf)
Stars: ✭ 284 (+3.27%)
Mutual labels:  generator, code-generator
ncg-crud-ngx-md
Angular 4+ Material Design CRUD/Admin app by NinjaCodeGen http://DNAfor.NET
Stars: ✭ 36 (-86.91%)
Mutual labels:  crud, code-generator
Yii2 Enhanced Gii
Enhanced Yii2 Gii (generator) that generates related Models & CRUD
Stars: ✭ 183 (-33.45%)
Mutual labels:  crud, generator
Generate
A new command line tool and developer framework for scaffolding out GitHub projects. Generate offers the robustness and configurability of Yeoman, the expressiveness and simplicity of Slush, and more powerful flow control and composability than either.
Stars: ✭ 238 (-13.45%)
Mutual labels:  rails, generator
badaso
The API & platform builder, build your apps 10x faster even more, it's open source & 100% free !
Stars: ✭ 650 (+136.36%)
Mutual labels:  crud, generator
Rails kindeditor
Kindeditor for Ruby on Rails
Stars: ✭ 263 (-4.36%)
Mutual labels:  rails
Il2c
IL2C - A translator for ECMA-335 CIL/MSIL to C language.
Stars: ✭ 270 (-1.82%)
Mutual labels:  transpiler

Go on Rails

Use Rails to generate Golang code or manage Go app development

Gem Version Build Status Maintainability MIT License


用 Rails 开发 Go 应用:中文文档

go-on-rails is a Rails generator aims to:

  1. Help to develop and integrate some APIs written in Golang to existing Rails app for high performance
  2. Use your familiar Rails tools to develop and manage a Golang app project
  3. Convert a not very complicated Rails app to Golang equivalent

Here's some examples:

Prerequisites

  • Rails 4.2+ (Rails 6 not supported and need your help)
  • Golang 1.10.x(mainly be compatible with github.com/go-sql-driver/mysql)

Installation

Add this line to your application's Gemfile:

gem 'go-on-rails', '~> 0.4.0'

And then execute:

$ bundle

Or install it yourself as:

$ gem install go-on-rails

Usage

You must have an existing Rails app or to create a new one before you try go-on-rails to generate Golang codes.

After that you can run the command just as other Rails generators:

rails g gor [dev(elopment) | pro(duction) | test | ...] [-m model_a model_b model_c ...]

# OR (on rails version < 5.0)
rake g gor ...

here we take generating all models for the development environment for example:

rails g gor dev

Then a folder named go_app that includes Golang codes will be generated under your Rails app root path.

Install the dependent Golang packages for this Go project:

rails gor:deps

Then change to the go_app directory and run:

go run main.go

You can visit the page in http://localhost:4000 by default.

More command details about go-on-rails generator:

rails g gor --help

What will be generated?

  • Go project directory layout (all under the go_app directory, like views, controllers, public)
  • A Go data struct corresponding to each activerecord model
  • And each struct related CRUD functions/methods like FindModel, UpdateModel, DestroyModel etc. All these models related program files under the go_app/models directory
  • And godoc files for all the functions under go_app/models/doc
  • We use Gin as the default web framework, but you can change it to anyone that you favor in main.go and controllers programs

View the godoc of all functions

You can view the godoc page of all functions in http://localhost:7979/doc/models.html after run:

rails gor:doc

Besides, there's a sample project generated by go-on-rails, you can view its godoc at godoc.org just now to get a picture of what functions are generated.

Known issues and TODOs

The gem is still under development, so there're some known issues. You're welcomed to contribute. 👏

  • databases specific functions between MySQL and Postgres or other databases are not covered completely
  • sql.NullType not supported yet, so you'd better in the migrations set those columns "not null" with a default value that's consistent with Golang's zero value specification, such as "" default for string and text typed column, and 0 default for int, etc. And now we have an alternative approach for manipulating the database nullable fields, see the wiki Working with database nullable fields
  • [x] Associations
    • [x] has_many
    • [x] has_one
    • [x] belongs_to
    • [x] dependent
  • [x] Validations
    • [x] length
    • [x] presence
    • [x] format(string only)
    • [x] numericality(partially)
    • [ ] other validations
  • [x] Pagination(details see wiki)
  • [ ] Callbacks
  • [ ] Transactions

Supported databases

  • SQLite
  • MySQL
  • Postgres

Wiki

Golang dependencies by default

Acknowledgement

When I had the idea to convert Rails app or build Golang app with Rails tools, I searched github and found the project: https://github.com/t-k/ar2gostruct. And from ar2gostruct I copied some codes on handling data structure conversion and models association, it made my idea come true faster than I imagined.

Contributing

There're two branches at present: master and dev.

The dev branch has a whole Rails environment for development: models, seeds for testing, and under go_app directory there's a file named models_test.go used to test generated Golang codes.

  • Fork the project switch to branch dev.
  • Make your feature addition or bug fix.
  • Add tests for it. This is important so I don't break it in a future version unintentionally.
  • Commit, do not mess with Rakefile or version (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
  • Send me a pull request. Bonus points for topic branches.

Testing

We create four models for testing:

  • Physician
  • Patient
  • Appointment
  • Picture

Run rails db:seed to use the data defined in db/seeds.rb. And change to go_app/models directory to run go test to test generated models-related functions. The test covers a small part of the functions currently. More will be added later on.

License

See the LICENSE file.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].