handlergen

command module
v0.0.0-...-f90b774 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2021 License: ISC Imports: 7 Imported by: 0

README

HandlerGen

Notice

If you happen to stumble on this, it is barely functional, and unmaintained. My effort goes in favor of https://github.com/discord-gophers/goapi-gen, which fullfills my goals and ideas, and has more traction.

Description

A go net/http HandlerFunc code generator. Parses all your args and give them to you as function arguments, which you can then validate and use.

Features

Multiple arguments format supported:

  • Query URL
  • HTTP headers
  • Request Body
  • URL Path, using go-chi

Fully net/http complient

Codegen, no slow downs!

Installation

Install Handlergen with the go toolchain

go install github.com/Karitham/handlergen@latest

Usage/Examples

Describe the function you want

functions:
  example1:
    query:
      user_id:
        type: int
    body:
      type: gen.Template
      import: github.com/Karitham/handlergen/gen

and codegen a httphandler

handlergen -file _example/basic/basic.yaml > _example/basic/generated.go

View more examples

Documentation

flag default value description
file handlers.yaml handlers gen config file
format handlergen input file format, use openapi for an open api file
pkg handlers package name

Authors

License

ISC

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
_example
advanced
Code generated by github.com/Karitham/handlergen.
Code generated by github.com/Karitham/handlergen.
basic
Code generated by github.com/Karitham/handlergen.
Code generated by github.com/Karitham/handlergen.
petstore
Code generated by github.com/Karitham/handlergen.
Code generated by github.com/Karitham/handlergen.

Jump to

Keyboard shortcuts

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