blob: 8992a8c168355b5fe6b371abfdd610eb2e26d2c2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# hh
This projects is a code generation tool and library for creating wrapper functions around web
request handlers that parse data out of the request.
The code generator tool is located at `./cmd/generate` and the library which shall be included is
located at `.`. In `./examples`, there are usage examples available.
The tool, when invoked on a go module (a directory) goes through all go files and finds functions
with `//hh:route` directives. For each of these functions (which shall be route handlers), it
creates a wrapper function. To do this, it looks at a parameter defined as an inline struct which
specifies which fields should be retrieved from the request.
## Commands
To test the project, run these commands in order:
- Run the code generation tool: `go generate ./examples`
- Compile the output: `go build -o /dev/null ./examples`
## Tests
This project only have integration tests, which also serve as examples. These are located in the
`./examples/` directory. They should test all available functionality of hh. Running `go test` is
therefore never relevant.
|