util

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package util provides utility functions for the schdl application.

Package util provides utility functions for the schdl application.

Package util provides utility functions for the schdl application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertInt64ToInt

func ConvertInt64ToInt(fn Int64Func) (int, error)

ConvertInt64ToInt converts the result of a function returning int64 to an int. It takes a function fn of type Int64Func as input, calls it to get the int64 result, and converts it to int. It returns the converted int result and any error encountered.

func PromptInput

func PromptInput(label string) (string, error)

Create promptui Input Prompt

func PromptInputWithDefault

func PromptInputWithDefault(label, defaultValue string) (string, error)

Create promptui Input Prompt with Default Value

func PromptSelect

func PromptSelect(label string, items []string) (string, error)

Create promptui Select Items

func PromptSelectWithDefault

func PromptSelectWithDefault(label string, items []string, defaultValue string) (string, error)

Create promptui Select Items with Default Value

func ValidateTask

func ValidateTask(task *Task) error

ValidateTask validates a task by checking its title, description, due date, and priority.

Types

type Int64Func

type Int64Func func() (int64, error)

Int64Func represents a function that returns an int64 and an error.

type Priority

type Priority string

Priority represents the priority of a task.

const (
	// High priority task.
	High Priority = "high"
	// Medium priority task.
	Medium Priority = "medium"
	// Low priority task.
	Low Priority = "low"
)

type Task

type Task struct {
	// ID is the unique identifier of the task.
	ID int
	// Title is the title or name of the task.
	Title string
	// Description is the description or details of the task.
	Description string
	// DueDate is the deadline or due date of the task.
	DueDate time.Time
	// Priority is the priority level of the task.
	Priority Priority
}

Task represents a task with its details.

Jump to

Keyboard shortcuts

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