ubresponse

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Response

type Response[T any] struct {
	Status           ubstatus.StatusCode            `json:"status"`
	Message          string                         `json:"message,omitempty"`
	ValidationIssues []ubvalidation.ValidationIssue `json:"validationIssues,omitempty"`
	Data             T                              `json:"data,omitempty"`
}

Response is a generic response type that can be used to return data from a command or query.

func Error

func Error[T any](message string) Response[T]

func StatusError

func StatusError[T any](status ubstatus.StatusCode, message string) Response[T]

func Success

func Success[T any](data T) Response[T]

func SuccessAny

func SuccessAny() Response[any]

func ValidationError

func ValidationError[T any](issues []ubvalidation.ValidationIssue) Response[T]

func (Response[T]) ToJSON

func (r Response[T]) ToJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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