Home

Awesome

Go Version

SQLBoiler extensions demo

Step-by-step

  1. Add sqlboiler-extensions to your project

    # Method 1: use go get
    go get -u github.com/tiendc/sqlboiler-extensions@latest
    
    # Method 2: add the extensions to your project as a submodule
    # NOTE: if use this method, you need to use relative path in Makefile (--templates ./db/extensions/...)
    git submodule add --name "db/extensions"  https://github.com/tiendc/sqlboiler-extensions.git "db/extensions"
    git submodule update --init
    
  2. Start the equivalent test env (there are tests for mysql, postgres, and cockroachdb)

    docker-compose -f docker-compose.<<db>>.yaml up -d // <<db>> can be 'mysql', 'postgres', 'crdb'
    
  3. Generate DB models with SQLboiler (see Makefile for details)

    make prepare
    make gen-models-<<db>> // <<db>> can be 'mysql', 'postgres', 'crdb'
    
  4. Run the test code (you can see the detailed usage in main)

    make run-test-<<db>> // <<db>> can be 'mysql', 'postgres', 'crdb'