controllers

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusOK                 string = "OK"
	StatusPartiallyAvailable string = "Partially Available"
	StatusUnavailable        string = "Unavailable"
	StatusTimeout            string = "Timeout during health check"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Check

type Check struct {
	// Status is the check status.
	Status string `json:"status"`
	// Timestamp is the time in which the check occurred.
	Timestamp string `json:"timestamp"`
	// StartUp is the time to boot up the system.
	StartUp string `json:"startup"`
	// Uptime is the time in which the check occurred.
	Uptime string `json:"uptime"`
	// Failures holds the failed checks along with their messages.
	Failures map[string]string `json:"failures,omitempty"`
	// System holds information of the go process.
	System `json:"system"`
}

Check represents the health check response.

func NewCheck

func NewCheck(status string, failures map[string]string, startTime time.Time, bootTime time.Duration) Check

NewCheck returns a new HealthCheck struct

type HealthCheck

type HealthCheck interface {
	HealthCheck(ctx *gin.Context, startTime time.Time, bootTime time.Duration)
}

func NewHealthCheck

func NewHealthCheck() HealthCheck

type System

type System struct {
	// Version is the go version.
	Version string `json:"version"`
	// GoroutinesCount is the number of the current goroutines.
	GoroutinesCount int `json:"goroutines_count"`
	// TotalAllocBytes is the total bytes allocated.
	TotalAllocBytes int `json:"total_alloc_bytes"`
	// HeapObjectsCount is the number of objects in the go heap.
	HeapObjectsCount int `json:"heap_objects_count"`
	// TotalAllocBytes is the bytes allocated and not yet freed.
	AllocBytes int `json:"alloc_bytes"`
}

System runtime variables about the go process.

func NewSystemMetrics

func NewSystemMetrics() System

NewSystemMetrics returns a new SystemMetrics struct

type Template

type Template interface {
	Index(c *gin.Context)
	About(c *gin.Context)
	Stats(c *gin.Context)
	NotFound(c *gin.Context)
}

Template is a struct for go html/template

func NewTemplate

func NewTemplate() Template

NewTemplate is a function for new template

type User

type User interface {
	// Register creates a new user
	Register(ctx *gin.Context)
	// Login logs in a user
	Login(ctx *gin.Context)
	// RefreshToken refreshes the token
	RefreshToken(ctx *gin.Context)
	// View returns the public or private user details
	View(ctx *gin.Context)
	// Update updates the user details
	Update(ctx *gin.Context)
	// Delete deletes a user
	Delete(ctx *gin.Context)
}

User is a controller for users

func NewUser

func NewUser(userRepo repository.UserRepo) User

NewUser initializes a new user controller

Jump to

Keyboard shortcuts

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