cruder

command module
v0.0.0-...-6a21e17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 12, 2018 License: GPL-3.0 Imports: 1 Imported by: 0

README

cruder

Generate code for CRUD functions from a Go struct

Go Report Card

Usage

cruder is a tool to generate code for Create, Read, Update, Delete functions
from a Go struct. It supports multiple generators which currently are:

Functions that can be generated are:
- Create: Adds an entry
- Read: Gets an entry using an ID
- List: Gets multiple entries
- Update: Updates an entry
- Delete: Deletes an entry using an ID

Usage:
  cruder [command]

Available Commands:
  help        Help about any command
  pg          Generates CRUD methods for Postgresql, uses the lib/pg package

Flags:
      --fn stringArray           CRUD functions to generate, e.g. --fn "create" --fn "delete". Default to all functions (default [create,get,list,update,delete])
  -h, --help                     help for cruder
      --pkg string               package name for the generated code, default to the same package from input
      --primaryfield string      the field to use as primary key. Default to 'ID' if it exists in the <struct>
      --readfield stringArray    Fields in the struct that should be used for read operations (get,list). Default to all fields except the one used for softdelete
      --skipsuffix               Skip adding the struct name as suffix to the generated functions
      --softdeletefield string   the field to use for softdelete (should be of type nullable datetime field). Default to 'DeletedAt' if it exists in the <struct>
      --writefield stringArray   Fields in the struct that should be used for write operations (create,update). Default to all fields

Use "cruder [command] --help" for more information about a command.
Example
cruder --table=foos Foo example/example.go

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package main is a test package for cruder Package main contains CRUD methods that are generated by `cruder` Code generated by "cruder pg Foo ./example/example.go"; DO NOT EDIT
Package main is a test package for cruder Package main contains CRUD methods that are generated by `cruder` Code generated by "cruder pg Foo ./example/example.go"; DO NOT EDIT
pg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL