controllers

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2022 License: MIT Imports: 15 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 added in v0.1.0

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 added in v0.1.0

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

NewCheck returns a new HealthCheck struct

type HealthCheck added in v0.1.0

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

func NewHealthCheck added in v0.1.0

func NewHealthCheck() HealthCheck

type Note

type Note interface {
	Create(ctx *gin.Context)
	Read(ctx *gin.Context)
	ReadAll(ctx *gin.Context)
	Update(ctx *gin.Context)
	Delete(ctx *gin.Context)
	DeleteByUsername(ctx *gin.Context)
}

func NewNote

func NewNote(noteRepo repository.NoteRepo) Note

NewNote initializes note

type System added in v0.1.0

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 added in v0.1.0

func NewSystemMetrics() System

NewSystemMetrics returns a new SystemMetrics struct

type User added in v0.1.0

type User interface {
	// SignUp creates a new user
	SignUp(ctx *gin.Context)
	// LoginUser logs in a user
	SignIn(gin *gin.Context)
	// RefreshToken refreshes the token
	RefreshToken(ctx *gin.Context)
	// SignOut logs out a user
	SignOut(gin *gin.Context)
	// UserDetails returns the user details from token
	UserDetails(ctx *gin.Context)
	// ViewUser returns the public user
	ViewUser(ctx *gin.Context)
	// UpdateUser updates the user details
	UpdateUser(ctx *gin.Context)
	// DeleteUser deletes a user
	DeleteUser(ctx *gin.Context)
}

User is a controller for users

func NewUser added in v0.1.0

func NewUser(userRepo repository.UserRepo) User

NewUser initializes a new user controller

type Views added in v0.1.0

type Views interface {
	App(ctx *gin.Context, fsRoot fs.FS)
	About(ctx *gin.Context, fsRoot fs.FS)
	Login(ctx *gin.Context, fsRoot fs.FS)
	Register(ctx *gin.Context, fsRoot fs.FS)
	MyAccount(ctx *gin.Context, fsRoot fs.FS)
	NotFound(ctx *gin.Context, fsRoot fs.FS)
	Delete(ctx *gin.Context, fsRoot fs.FS)
	DeleteNote(ctx *gin.Context, fsRoot fs.FS)
}

func NewViews added in v0.1.0

func NewViews() Views

NewViews returns a new Views

Jump to

Keyboard shortcuts

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