jsonutil

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Overview

package json handle all http json operations like decode input or output json response

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapToStruct

func MapToStruct(dict map[string]any, target any) error

MapToStruct converts a map[string]any to a struct target is a pointer of the target struct

func Write

func Write(w http.ResponseWriter, data any)

Types

type Response

type Response struct {
	Code int    `json:"-"` // write to http status code
	Msg  string `json:"msg"`
}

Response serves a default JSON output when no data fetched from data

func ErrResponse

func ErrResponse(err error) *Response

Jump to

Keyboard shortcuts

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