Skip to content

Commit

Permalink
docs: add doc comments to packages (#203)
Browse files Browse the repository at this point in the history
  • Loading branch information
abemedia authored Feb 21, 2024
1 parent aa8806a commit aba5b1c
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion api.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package don provides a fast and efficient API framework.
package don

import (
Expand Down Expand Up @@ -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)
}
Expand Down
1 change: 1 addition & 0 deletions encoding/form/form.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package form provides decoding of form data.
package form

import (
Expand Down
1 change: 1 addition & 0 deletions encoding/json/json.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package json provides encoding and decoding of JSON data.
package json

import (
Expand Down
1 change: 1 addition & 0 deletions encoding/msgpack/msgpack.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package msgpack provides encoding and decoding of MessagePack data.
package msgpack

import (
Expand Down
1 change: 1 addition & 0 deletions encoding/protobuf/protobuf.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package protobuf provides encoding and decoding of Protocol Buffers data.
package protobuf

import (
Expand Down
1 change: 1 addition & 0 deletions encoding/text/text.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package text provides encoding and decoding of plain text data.
package text

import (
Expand Down
1 change: 1 addition & 0 deletions encoding/toml/toml.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package toml provides encoding and decoding of TOML data.
package toml

import (
Expand Down
1 change: 1 addition & 0 deletions encoding/xml/xml.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package xml provides encoding and decoding of XML data.
package xml

import (
Expand Down
1 change: 1 addition & 0 deletions encoding/yaml/yaml.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package yaml provides encoding and decoding of YAML data.
package yaml

import (
Expand Down
3 changes: 3 additions & 0 deletions internal/byteconv/byteconv.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
// Package byteconv provides fast and efficient conversion functions for byte slices and strings.
package byteconv

import (
"reflect"
"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)
Expand Down
2 changes: 2 additions & 0 deletions pkg/httptest/request.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package httptest provides utilities for testing fasthttp handlers.
package httptest

import (
Expand All @@ -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)
Expand Down

0 comments on commit aba5b1c

Please sign in to comment.