Giter Club home page Giter Club logo

db-gen's People

Contributors

dependabot[bot] avatar filipjakab avatar ondrejvalenta avatar zelvaman avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

db-gen's Issues

"db-gen init" creates configuration and templates

Running dbgen init creates a configuration and/or templates in current folder.

  • init command should be probably interactive and ask user for values it needs
  • generated dbgen.json will contain values based on user input or default values stored in the db-gen package
  • templates will most probably be downloaded from internet (??) from repository like db-gen-templates, where are folders for given language and perhaps even ORM framework?

Log total changes

Improve logging to show what procedures were changed, added, deleted

Allow splitting of loading procedures and generating code

db-gen should save all loaded procedures to some intermediate file. This would allow users to regenerate files without having access to database. This also opens up new opportunity for future use cases (eg. verifying that database has all required procedures).

This is not a breaking change and should just be opt-in.

New command will be added, that will just create file with all procedures
New parameter would be added to generate command, that will skip process of loading procedures from database and user provided file instead

option to mark function/procedure parameters with security flag

  • security flag describes the sensitivity level of given parameter
  • security levels are 'none', 'secure', 'strict', 'omit'
  • security levels can be used in code generation for secure logging
  • none level means parameter can be safely added to log message
  • secure level means parameter can be added to log message based on configuration value 'db-gen:insecure-logging'. When this value is true, parameter is added to log as plain text, when false parameter is added to log as ******
  • strict level means parameter is always added to log as ******
  • omit level means parameter is always omitted from any log

Add ability to specify custom mapping for each function

User should be able to override information about function that is returned from database.

This will be only used in some edge cases, so it should not create burden on rest of usecases.

User should be able to change:

  • function name
  • function params (name, type, isNullable)
  • return mode (model name, properties names, types and nullability)
  • only select some properties from function

User shouldnt have to specify every mapping, only those that he wants to override

Propoposed configuration:

// ...
"Generate": [
	{
		"Schema": "public",
		"AllFunctions": true,
		"Functions": {
			// maybe not best idea to store values in keys (probably ok)
			"database_function_to_be_ignore": false,
      // in case of function overloading, you have to explicitly specify mapping
			"function_with_custom_mappings(int,int,text)":{
        // name of function in generated code
        // by default model is named customNameModel and processor customNameProcessor
				"MappedName": "customName",

        // client can use execute instead of select to save bytes
        "DontSelectValue": true,

				"SelectAllColumns": true,
				"Model":{
					// explicitly remove
					"column1": false,
					"column2":{
						// not required
						"MappedName": "better_name_for_col2",

						"MappedType": "int", 
						// if mapping function is not set use one defined in global mappings
						"MappingFunction":"mapToInt",
						// this infomation is not used by db-gen, but can be used in templates
						"IsNullable": false
					}
				},
				// it doesnt really make sence to send only some parameters, so you are only able to override name and dataType?
				"Parameters":{
					"function_parameter": {
						"IsNullable": true,
						"MappedName": "better_name",
						"MappedType": "int"
					}
				}

			}
		}
	},
	{
		"Schema": "test",
		"AllFunctions": false,
		"Functions": {
			"explicitly_included": true,
			"another_included_func": true
		}
	}
],
// ...

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.