GithubHelp home page GithubHelp logo

sqlc-gen-ruby's Introduction

CI

sqlc-gen-ruby

Why I didn't use Ruby to generate Ruby in here.

Usage

Options Documentation

Option Possible values Optional Info
driver values: mysql2,pg, sqlite3 No Choosing the driver to use - see here for more details info.
rubyVersion default: 3.3
values: 3.1, 3.2, 3.3
Yes Determines the Ruby version the generated code should support..
generateGemfile default: false
values: false,true
Yes Assists you with the integration of SQLC and Ruby by generating a Gemfile with the needed dependencies.
generateTypes default: true
values: false,true
Yes Determines whether to generate type signatures in addition to the code.

Configuration

version: "2"
plugins:
- name: ruby
  wasm:
    url: https://github.com/DaredevilOSS/sqlc-gen-ruby/releases/download/${RELEASE_TAG}/sqlc-gen-ruby.wasm
    sha256: ${RELEASE_SHA}
sql:
  # PostgreSQL Example
  - schema: "examples/authors/postgresql/schema.sql"
    queries: "examples/authors/postgresql/query.sql"
    engine: "postgresql"
    codegen:
      - plugin: ruby
        out: examples/pg
        options:
          driver: pg
          rubyVersion: "3.3"
          generateTypes: true
          generateGemfile: false
  # MySQL Example
  - schema: "examples/authors/mysql/schema.sql"
    queries: "examples/authors/mysql/query.sql"
    engine: "mysql"
    codegen:
      - plugin: ruby
        out: examples/mysql2
        options:
          driver: mysql2
          rubyVersion: "3.3"
          generateTypes: true
          generateGemfile: false
  # Sqlite3 Example
  - schema: "examples/authors/sqlite/schema.sql"
    queries: "examples/authors/sqlite/query.sql"
    engine: "sqlite"
    codegen:
      - plugin: ruby
        out: examples/sqlite3
        options:
          driver: sqlite3
          rubyVersion: "3.3"
          generateTypes: true
          generateGemfile: false

Next features

  1. Supporting sqlite engine, utilizing sqlite3 gem
  2. Adding type support to generated code by generating .rbs files

Contributing

Local plugin development

Prerequisites

make sure that the following applications are installed and exposed in your path

Follow the instructions in each of these:

Protobuf

SQLC protobuf are defined in sqlc-dev/sqlc repository. Generating Ruby code from protocol buffer files:

rake protobuf_generate

Generating code

SQLC utilizes our process / WASM plugin to generate code

rake sqlc_generate_process
rake sqlc_generate_wasm

Testing generated code

Testing the SQLC generated code via a predefined flow:

rake test_process_plugin
rake test_wasm_plugin

Release flow

The release flow in this repo follows the semver conventions, building tag as v[major].[minor].[patch].

  • In order to create a release you need to add [release] somewhere in your commit message when merging to master

Version bumping (built on tags)

By default, the release script will bump the patch version., by adding [release] to your commit message the release script will create a new tag with v[major].[minor].[patch]+1.

  • Bump minor version by adding [minor] to your commit message resulting in a new tag with v[major].[minor]+1.0
  • Bump major version by adding [major] to your commit message resulting in a new tag with v[major]+1.0.0

Release structure

The new created tag will create a draft release with it, in the release there will be the wasm plugin embedded in the release.

Publish the draft

sqlc-gen-ruby's People

Contributors

github-actions[bot] avatar sockworkorange avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

sqlc-gen-ruby's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.