Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@artheus
Last active September 25, 2016 10:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save artheus/71974e07e33f08edb507fb5d1b812aaa to your computer and use it in GitHub Desktop.
Save artheus/71974e07e33f08edb507fb5d1b812aaa to your computer and use it in GitHub Desktop.
Sample config, API backend generation
!import "common.groovy"
!import "springboot.groovy"
!import "postgres.groovy"
!merge "moreConfig.yaml" #!dominant
!merge "otherConfig.yaml" #!submissive
springboot:
- db: "postgres"
postgres:
- production:
- host: "database.example.com"
- username: "username"
- password: "password"
- staging:
- host: "stagingdb.example.org"
- username: "staging"
- password: "changeme"
- development:
- default: true
- host: "localhost"
- username: "clientdatabase"
- password: "test"
api:
- name: "ClientDatabase"
- type: "springboot"
- entities:
- client:
- id: "PK,AI"
- name:
- type: "string"
- length: 128
- wealth:
- type: "long"
- households:
- relation: "multi household"
- related:
- relation: "multi client"
- household:
- id: "PK,AI"
- address:
- type: "string"
- length: 256
- endpoints:
- "household/calculate_price": ´sum(household.getClients()*.getWealth()) * 0.15´
@artheus
Copy link
Author

artheus commented Sep 25, 2016

The idea is that the entities will be generated as Java Spring beans the database and everything will be set up automagically.
The generates source from this should be accessable in class_path and overrides,additions,etc to the api can be made with regular java code.

Could be a good idea to have a cli tool for this to, so that you can with that generate single or complete sets of overriding classes generated from this configuration.

@artheus
Copy link
Author

artheus commented Sep 25, 2016

I think it might also be a cool idea to use Java 8 Streams for adding functionality to the generated api. Maybe even using streams to override etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment