GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - jempe/code_generator: Code Generator A CLI tool that automates code generation from database schemas and templates, reducing repetitive coding tasks.

BranchesTags
Open more actions menu

Latest commit

 

History

23 Commits
23 Commits

Folders and files

NameName
Last commit message
Last commit date
cmd/jempe_code_generator
cmd/jempe_code_generator
 
 
generator
generator
 
 
test
test
 
 
utils
utils
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
go.mod
go.mod
 
 
go.sum
go.sum
 
 

Repository files navigation

Code Generator

A CLI tool that automates code generation from database schemas and templates, reducing repetitive coding tasks.

Struct Variables:

StructName name

StructPluralName name + "s"

TableName table

TableItem item

KeyType type of field where key equals true

KeyName name of field where key equals true

KeyFieldName field_name or name (lowercase) of field where key equals true

StructVar name (camelcase)

OpenBraces {{

CloseBraces }}

Field Variables:

Name name

FieldName field_name or name (lowercase)

Key true if field is tablet key

Type type

Maxlength maxlength

Minlength minlength

DBExtras db_extras

DBDefault db_default

Reference reference

ReferenceType "" or type of the foreign table ID if type equals reference

ValidateFunction validate_function or Valid + name + Default

Usage

To generate code using this tool, you need to provide a schema file, specify the table, and include at least one template file. Here is the basic usage:

jempe_code_generator -schema=schema.json -table=users templates/user.tmpl

Example

jempe_code_generator -schema=schema.json -table=users templates/user.tmpl

Options

  • -output: Path of the output file. If not provided, the generated code will be printed to the standard output.
  • -schema: Path of the schema file. This file should contain the database schema.
  • -table: Name of the table for which you want to generate code.
  • -overwrite: If set to true, existing files will be overwritten.
  • -template_files: List of template files to be used for code generation.

Example with Output File

jempe_code_generator -schema=schema.json -table=users -output=generated_code.go templates/user.tmpl

This command will generate the code based on the provided schema and template files and save it to generated_code.go.

Notes

  • Ensure the schema file exists and is correctly formatted.
  • Provide at least one template file to generate the code.
  • If the output file already exists and you don't use the -overwrite flag, the tool will not overwrite the existing file.

About

Code Generator A CLI tool that automates code generation from database schemas and templates, reducing repetitive coding tasks.

Topics

code-generation

Resources

Readme
License
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.