web

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: GPL-3.0 Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package web serves the invoice web app.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Access

type Access interface {
	CurrentUser(*gin.Context) (*access.User, bool)
	Login(*gin.Context)
	Callback(*gin.Context)
	Logout(*gin.Context)
}

Access signs users in and reports the current user.

type Server

type Server struct {
	*gin.Engine
	// contains filtered or unexported fields
}

Server serves the invoice web app.

func New

func New(s Store, a ...Access) *Server

New returns a server that lists invoices from s. When a is provided, the server also serves the sign-in, callback, and sign-out routes.

func NewServer

func NewServer(s Store) *Server

NewServer returns a server that lists invoices from s.

func (*Server) Handler

func (s *Server) Handler() http.Handler

Handler returns the HTTP handler for the server.

func (*Server) Router

func (s *Server) Router() http.Handler

Router returns the HTTP router for the server.

type Store

type Store interface {
	List() ([]*invoice.Invoice, error)
	GetByMonth(year int, month time.Month) (*invoice.Invoice, error)
	SetProject(year int, month time.Month, project string) error
	SetPaid(year int, month time.Month, paid bool) error
}

Store provides the invoices the web app reads and changes.

Jump to

Keyboard shortcuts

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