bananas

package module
v0.0.0-...-66a381b Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

README

bananas

or maybe I should have called it go-bananas. This is a cli tool to setup an opinionated golang base project.

The opinion being, write request, response using annotations in proto and service, and generate

  • docs
  • request, response models
  • controllers

Rest of it is common setup needed for web dev.

batteries
  • server with echo and graceful termination
  • cli
  • zerolog for logger
  • config setup
  • database setup
    • defaults to sqlx and sqlite3
  • redis connection setup
  • bcrypt and ulid for hashing and id generation.
  • protos this is where one writes their api, and the tool generates:
    • request, response models
    • dummy controller
    • automatic openapiv2 doc generation
usage

Make sure the bananas executable is in $PATH.

$> mkdir -p testproj; cd testproj
$> go mod init testproj
$> bananas init -n testproj
$> go mod tidy

$> cp -r examples/protos/web/hellow protos/web/
$> bananas gen:docs --path=./protos/web # generates swagger.yaml

$> # generate the pb.go files, not fully supported yet in server
$> bananas gen:structs --path=./protos/web 
building

For linux: make build.cli

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BaseFS embed.FS
View Source
var DbFS embed.FS
View Source
var PkgFS embed.FS
View Source
var ScriptsFS embed.FS

Functions

func MustRenderTmpl

func MustRenderTmpl(
	templateFs embed.FS, templateFile string, data TemplData,
) (outPath string, content *bytes.Buffer, ok bool)

func WriteFile

func WriteFile(filePath string, content *bytes.Buffer) error

Types

type TemplData

type TemplData map[string]any

Directories

Path Synopsis
cmd
cli command

Jump to

Keyboard shortcuts

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