Help us shape the future of Go! Take the 2026 Go Developer Survey

api

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: GPL-3.0 Imports: 57 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunBranchTargetSeriesScheduler

func RunBranchTargetSeriesScheduler(ctx context.Context, store db.Store, hub *branchHub)

RunBranchTargetSeriesScheduler ensures every active recurring target series has a branch_targets row for its current period, immediately on startup (so a period that started while the server was down still gets created promptly) and then on a fixed tick, for the life of the process. hub is used to push a live "go re-fetch targets" notification to the owning branch the moment a period fires, same as branch API handlers do on write -- see Server.BranchHub.

Types

type Attributes

type Attributes struct {
	Category    string `json:"category"`
	SubCategory string `json:"subcategory"`
	Brand       string `json:"brand"`
	Kind        string `json:"kind"`
	Type        string `json:"type"`
	Unit        string `json:"unit"`
	Year        string `json:"year"`
	Season      string `json:"season"`
	Origin      string `json:"origin"`
}

type CloseShiftRequest

type CloseShiftRequest struct {
	ID int64 `uri:"id" binding:"required,min=1"`
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(config util.Config, store db.Store) (*Server, error)

func (*Server) BranchHub

func (server *Server) BranchHub() *branchHub

BranchHub exposes the server's live-push hub so background schedulers (e.g. RunBranchTargetSeriesScheduler) that run outside a request's lifecycle can notify connected branches too, using the same connections branch API handlers push through.

func (*Server) CloseShift

func (server *Server) CloseShift(ctx *gin.Context)

func (*Server) RunClientSpendRefresh added in v1.1.6

func (server *Server) RunClientSpendRefresh(ctx context.Context)

RunClientSpendRefresh (also tops up clients' phone flags) rebuilds the client_spend cache at start-up and then every few minutes. The clients and loyalty pages read it instead of summing every invoice per request, so a new sale shows up in the rankings within one interval.

func (*Server) RunEmailScheduler added in v1.1.0

func (server *Server) RunEmailScheduler(ctx context.Context)

RunEmailScheduler sends due scheduled reports, on startup (catching up on one missed while kashi was down, once) and then every emailScheduleCheckInterval, for the life of the process.

func (*Server) RunGooglePlacesScheduler added in v1.1.0

func (server *Server) RunGooglePlacesScheduler(ctx context.Context)

RunGooglePlacesScheduler checks the places shortly after start, then every googlePlacesEvery.

func (*Server) RunSecurity added in v1.1.0

func (server *Server) RunSecurity(ctx context.Context)

RunSecurity keeps the request guard's settings, bans and visitor counts in step with the database and the IP-location databases current, until ctx ends (security.go). main starts it; tests don't.

func (*Server) RunUnknownImageCleanup added in v1.1.1

func (server *Server) RunUnknownImageCleanup(ctx context.Context)

RunUnknownImageCleanup deletes old unknown-item pictures once a day, when the app setting unknown_images_auto_delete is on (off by default).

func (*Server) Start

func (server *Server) Start(address string) error

Source Files

Jump to

Keyboard shortcuts

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