Skip to content

Latest commit

 

History

History

example

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

example

an example project to show what code gets generated by running generate. edit sqlxgen.yaml to verify behaviour

postgresql server

run following to start postgresql server from the root of this project

test ! -f $(pwd)/fixtures/pg/seed.sh && echo 'Must run from the project root!' || \
docker run -d --name tmdb-pg \
  -v $(pwd)/fixtures/pg/seed.sh:/docker-entrypoint-initdb.d/seed.sh \
  -v $(pwd)/fixtures/pg/01.features.sql:/tmp/01.features.sql \
  -v $(pwd)/fixtures/pg/02.schema.sql:/tmp/02.schema.sql \
  -v $(pwd)/fixtures/pg/03.data.sql:/tmp/03.data.sql \
  -p 54320:5432 \
  -e POSTGRESQL_POSTGRES_PASSWORD=postgres \
  -e POSTGRESQL_USERNAME=app \
  -e POSTGRESQL_PASSWORD=app \
  -e POSTGRESQL_DATABASE=app \
  bitnami/postgresql:16;

mysql server

run following to start mysql server from the root of this project

test ! -f $(pwd)/fixtures/pg/seed.sh && echo 'Must run from the project root!' || \
docker run -d --name tmdb-mysql \
  -v $(pwd)/fixtures/mysql/backup.sql:/docker-entrypoint-initdb.d/backup.sql \
  -p 33070:3306 \
  -e MYSQL_ROOT_USER=root \
  -e MYSQL_ROOT_PASSWORD=root \
  -e MYSQL_USER=app \
  -e MYSQL_PASSWORD=app \
  -e MYSQL_DATABASE=app \
  -e MYSQL_AUTHENTICATION_PLUGIN=mysql_native_password \
  bitnami/mysql:8.0;

then run following to generate code

sqlxgen generate

generated code

postgresql models
postgresql queries

mysql models
mysql queries