diff --git a/api.go b/api.go index bbd298e..1dda703 100644 --- a/api.go +++ b/api.go @@ -1,3 +1,4 @@ +// Package don provides a fast and efficient API framework. package don import ( @@ -101,7 +102,7 @@ func (r *API) Handler(method, path string, handle http.Handler) { r.router.Handler(method, path, handle) } -// HandlerFunc is an adapter which allows the usage of an http.HandlerFunc as a request handle. +// HandleFunc is an adapter which allows the usage of an http.HandlerFunc as a request handle. func (r *API) HandleFunc(method, path string, handle http.HandlerFunc) { r.router.HandlerFunc(method, path, handle) } diff --git a/encoding/form/form.go b/encoding/form/form.go index 7743d73..099e504 100644 --- a/encoding/form/form.go +++ b/encoding/form/form.go @@ -1,3 +1,4 @@ +// Package form provides decoding of form data. package form import ( diff --git a/encoding/json/json.go b/encoding/json/json.go index 01a99b0..34110cf 100644 --- a/encoding/json/json.go +++ b/encoding/json/json.go @@ -1,3 +1,4 @@ +// Package json provides encoding and decoding of JSON data. package json import ( diff --git a/encoding/msgpack/msgpack.go b/encoding/msgpack/msgpack.go index 6936b81..cdce4be 100644 --- a/encoding/msgpack/msgpack.go +++ b/encoding/msgpack/msgpack.go @@ -1,3 +1,4 @@ +// Package msgpack provides encoding and decoding of MessagePack data. package msgpack import ( diff --git a/encoding/protobuf/protobuf.go b/encoding/protobuf/protobuf.go index f2e072d..c65d4f5 100644 --- a/encoding/protobuf/protobuf.go +++ b/encoding/protobuf/protobuf.go @@ -1,3 +1,4 @@ +// Package protobuf provides encoding and decoding of Protocol Buffers data. package protobuf import ( diff --git a/encoding/text/text.go b/encoding/text/text.go index c974724..38aa6bf 100644 --- a/encoding/text/text.go +++ b/encoding/text/text.go @@ -1,3 +1,4 @@ +// Package text provides encoding and decoding of plain text data. package text import ( diff --git a/encoding/toml/toml.go b/encoding/toml/toml.go index bb29573..8dadbef 100644 --- a/encoding/toml/toml.go +++ b/encoding/toml/toml.go @@ -1,3 +1,4 @@ +// Package toml provides encoding and decoding of TOML data. package toml import ( diff --git a/encoding/xml/xml.go b/encoding/xml/xml.go index 33db9fe..43b0c4f 100644 --- a/encoding/xml/xml.go +++ b/encoding/xml/xml.go @@ -1,3 +1,4 @@ +// Package xml provides encoding and decoding of XML data. package xml import ( diff --git a/encoding/yaml/yaml.go b/encoding/yaml/yaml.go index 2ef30e9..a239c85 100644 --- a/encoding/yaml/yaml.go +++ b/encoding/yaml/yaml.go @@ -1,3 +1,4 @@ +// Package yaml provides encoding and decoding of YAML data. package yaml import ( diff --git a/internal/byteconv/byteconv.go b/internal/byteconv/byteconv.go index 9c537fc..6e7d669 100644 --- a/internal/byteconv/byteconv.go +++ b/internal/byteconv/byteconv.go @@ -1,3 +1,4 @@ +// Package byteconv provides fast and efficient conversion functions for byte slices and strings. package byteconv import ( @@ -5,10 +6,12 @@ import ( "unsafe" ) +// Btoa returns a string from a byte slice without memory allocation. func Btoa(b []byte) string { return *(*string)(unsafe.Pointer(&b)) } +// Atob returns a byte slice from a string without memory allocation. func Atob(s string) []byte { sp := unsafe.Pointer(&s) b := *(*[]byte)(sp) diff --git a/pkg/httptest/request.go b/pkg/httptest/request.go index 0b0e4da..c39549a 100644 --- a/pkg/httptest/request.go +++ b/pkg/httptest/request.go @@ -1,3 +1,4 @@ +// Package httptest provides utilities for testing fasthttp handlers. package httptest import ( @@ -6,6 +7,7 @@ import ( "github.com/valyala/fasthttp" ) +// NewRequest returns a new [fasthttp.RequestCtx] with the given method, url, body and header. func NewRequest(method, url, body string, header map[string]string) *fasthttp.RequestCtx { ctx := &fasthttp.RequestCtx{} ctx.Request.Header.SetMethod(method)