@dryv/go-net-http-backendv0.1.0
Standard-library Go net/http handlers with typed models and service boundaries.
dryv pack add @dryv/go-net-http-backendversion: dryv.pack/v1alpha1
key: unit.backend.go-net-http-backend
layout: unit
package:
name: { $ref: "#/inputs/package_name" }
source: templates
info:
title: Go net/http Backend
version: 0.1.0
description: Generates a dependency-free Go net/http backend package with typed models and feature service interfaces.
purpose: backend
summary: Standard-library Go net/http handlers with typed models and service boundaries.
languages: [go]
frameworks: [net-http]
tags: [backend, rest, http, go]
plugins:
- name: jinja
extensions: [.j2]
inputs:
package_name:
type: string
default: dryvserver
description: Go package identifier used by generated source files.
module_path:
type: string
default: example.com/dryvserver
description: Module path written to go.mod.
selections:
enums:
subject: property.enum
scope: each
models:
subject: schema
scope: each
routes:
subject: operation
filter:
all: { facet: http }
scope: collects.feature
templates:
enum:
$ref: "#/selections/enums"
output:
name: $(group.name.snake)_$(subject.name.snake)
symbol: $(group.name.pascal)$(subject.name.pascal)
model:
$ref: "#/selections/models"
output:
name: $(group.name.snake)_$(subject.name.snake)
symbol: $(group.name.pascal)$(subject.name.pascal)
imports:
- $ref: "#/templates/enum"
- $ref: "#/templates/model"
handler:
$ref: "#/selections/routes"
output:
name: $(group.name.snake)_$(feature.name.snake)
symbols:
service: $(group.name.pascal)$(feature.name.pascal)Service
register: Register$(group.name.pascal)$(feature.name.pascal)
imports:
- $ref: "#/templates/enum"
- $ref: "#/templates/model"
provides:
schema.types:
$ref: "#/templates/model"
property.enum.types:
$ref: "#/templates/enum"
# shared:go-actions:start
actions:
files:
format:
extensions: [.go]
commands:
- run: [gofmt, -w, $(files)]
final:
install:
commands:
- run: [go, mod, tidy]
# shared:go-actions:end