model

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package model provides the data models for the application.

Index

Constants

View Source
const (
	// Created is the status for a created task.
	Created = Status("created")
	// Processing is the status for a processing task.
	Processing = Status("processing")
	// Done is the status for a done task.
	Done = Status("done")
)

Variables

View Source
var ErrNotFound = fmt.Errorf("not found")

ErrNotFound is the error for not found.

View Source
var StatusMap = map[Status]bool{
	Created:    true,
	Processing: true,
	Done:       true,
}

StatusMap is a map of task status.

Functions

This section is empty.

Types

type Config

type Config struct {
	UI            UI
	APIServer     Server
	SwaggerServer Server
	SQLite        SQLite
}

Config is the configuration for the application.

type SQLite

type SQLite struct {
	DBFilename string `validate:"required"`
}

SQLite is the configuration for the SQLite database.

type Server

type Server struct {
	Enable bool
	Port   int
}

Server is the configuration for the server.

type Status

type Status string

Status is the status of the task.

type Todo

type Todo struct {
	ID        int `gorm:"primaryKey"`
	Task      string
	Status    Status
	CreatedAt time.Time `gorm:"autoCreateTime"`
	UpdatedAt time.Time `gorm:"autoUpdateTime"`
}

Todo is the model for the todo endpoint.

func NewTodo

func NewTodo(task string) *Todo

NewTodo returns a new instance of the todo model.

func NewUpdateTodo

func NewUpdateTodo(id int, task string, status Status) *Todo

NewUpdateTodo returns a new instance of the todo model for updating.

type UI

type UI struct {
	URL string `validate:"required"`
}

UI is the configuration for the UI.

Jump to

Keyboard shortcuts

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