sender

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2024 License: MIT, MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Error string `json:"error"`
}

type ExtendableSend

type ExtendableSend interface {
	Header() http.Header
	Empty() error
	Error(e any) error
	Json(value any) error
	Html(value string) error
	Xml(value any) error
	Text(value string) error
	Bool(value bool) error
	Redirect(url string) error
	File(name string, bytes []byte) error
	Asset(name string, bytes []byte) error
}

type Json

type Json struct {
	Result any `json:"result"`
}

type Send

type Send interface {
	Status(statusCode int) Send
}

type Sender

type Sender struct {
	Bytes       []byte
	DataType    string
	ContentType string
	Value       string
	StatusCode  int
	// contains filtered or unexported fields
}

func New

func New(request *http.Request, response http.ResponseWriter, write ...*bool) *Sender

func (*Sender) Asset

func (s *Sender) Asset(name string, bytes []byte) error

func (*Sender) Bool

func (s *Sender) Bool(value bool) error

func (*Sender) Empty

func (s *Sender) Empty() error

func (*Sender) Error

func (s *Sender) Error(e any) error

func (*Sender) File

func (s *Sender) File(name string, bytes []byte) error

func (*Sender) Header

func (s *Sender) Header() http.Header

func (*Sender) Html

func (s *Sender) Html(value string) error

func (*Sender) Json

func (s *Sender) Json(value any) error

func (*Sender) Redirect

func (s *Sender) Redirect(url string) error

func (*Sender) Status

func (s *Sender) Status(statusCode int) Send

func (*Sender) Text

func (s *Sender) Text(value string) error

func (*Sender) Xml

func (s *Sender) Xml(value any) error

Jump to

Keyboard shortcuts

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