benchfixture

package
v0.5.34 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package benchfixture backs the benchmark table in the project README.

Every generated path is paired with the standard-library way of doing the same job — encoding/json for the codecs, a hand-written net/http handler for bind and write, html/template for rendering — and the tests here assert the two halves of each pair produce the same result. A number is only worth quoting if the thing being compared is the same thing.

go test ./internal/benchfixture -run xxx -bench . -benchmem

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateUser

func CreateUser(w http.ResponseWriter, r *http.Request)

func EncodeOrder

func EncodeOrder(w io.Writer, v Order) error

func UserPage

func UserPage(params UserPageParams) htmlbind.Fragment

UserPage binds UserPage to its parameters, producing a renderable fragment.

Types

type CreateUserRequest

type CreateUserRequest struct {
	Name  string `input:"name"`
	Email string `input:"email"`
	OrgID string `path:"org_id"`
	Token string `header:"Authorization"`
}

type CreateUserResponse

type CreateUserResponse struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Email string `json:"email"`
	OrgID string `json:"org_id"`
}

type Customer

type Customer struct {
	Name  string `json:"name"`
	Email string `json:"email"`
	Tier  string `json:"tier"`
}

type LineItem

type LineItem struct {
	SKU   string  `json:"sku"`
	Qty   int     `json:"qty"`
	Price float64 `json:"price"`
}

type Order

type Order struct {
	ID       string     `json:"id"`
	Customer Customer   `json:"customer"`
	Items    []LineItem `json:"items"`
	Total    float64    `json:"total"`
	Paid     bool       `json:"paid"`
	Tags     []string   `json:"tags"`
	Note     string     `json:"note"`
}

func DecodeOrder

func DecodeOrder(r io.Reader) (Order, error)

type Row

type Row struct {
	Name   string
	Email  string
	Active bool
}

type UserPageParams

type UserPageParams struct {
	Title string
	Rows  []Row
}

Jump to

Keyboard shortcuts

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