utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2025 License: GPL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteJSONResponse

func WriteJSONResponse(w http.ResponseWriter, opts *ResponseOpts)

Types

type OrderingFilter

type OrderingFilter struct {
	Limit   int
	Offset  int
	OrderBy string
	Order   string
}

type ResponseOpts

type ResponseOpts struct {
	Code        int         `json:"code"`
	Data        interface{} `json:"data"`
	Error       bool        `json:"error"`
	Message     string      `json:"message"`
	Limit       *int        `json:"limit,omitempty"`  // Optional field
	Offset      *int        `json:"offset,omitempty"` // Optional field
	Total       *int        `json:"total,omitempty"`  // Optional field
	TotalPages  *int        `json:"total_pages,omitempty"`
	CurrentPage *int        `json:"current_page,omitempty"`
	HasNext     *bool       `json:"has_next,omitempty"`
	HasPrev     *bool       `json:"has_prev,omitempty"`
}

Jump to

Keyboard shortcuts

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