document

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateInput

type CreateInput struct {
	Name string
}

CreateInput is a new document; a file is required.

type Document

type Document struct {
	ID       int    `db:"id" json:"id"`
	Name     string `db:"name" json:"name"`
	FileName string `db:"file_name" json:"file_name"`
}

type Handlers

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

Handlers serves /documents.

func NewHandlers

func NewHandlers(svc *Service) *Handlers

func (*Handlers) Register

func (h *Handlers) Register(g *echo.Group, guards web.Guards)

Register mounts the document routes on the /api/v1 group.

type Public

type Public struct {
	ID      int    `json:"id"`
	Name    string `json:"name"`
	FileURL string `json:"fileUrl"`
}

Public is a downloadable club document as the API returns it.

type Service

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

Service is the document business logic.

func NewService

func NewService(store store, files *upload.Files) *Service

func (*Service) Create

func (s *Service) Create(ctx context.Context, in CreateInput, file *upload.File) (Public, error)

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, id int) (Public, error)

Delete removes the document and its file, returning what was deleted.

func (*Service) List

func (s *Service) List(ctx context.Context) ([]Public, error)

type Store

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

Store stores the dependencies

func NewDocumentRepo

func NewDocumentRepo(db *sqlx.DB) *Store

NewDocumentRepo stores our dependency

func (*Store) AddDocument

func (s *Store) AddDocument(ctx context.Context, documentParam Document) (Document, error)

func (*Store) DeleteDocument

func (s *Store) DeleteDocument(ctx context.Context, documentParam Document) error

func (*Store) GetDocument

func (s *Store) GetDocument(ctx context.Context, documentParam Document) (Document, error)

func (*Store) GetDocuments

func (s *Store) GetDocuments(ctx context.Context) ([]Document, error)

Jump to

Keyboard shortcuts

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