models

package
v0.0.0-...-27601ae Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tag

type Tag struct {
	Id   int    `json:"id"`
	Name string `json:"name"`
}

Represent a tag

func ListAllTags

func ListAllTags() []Tag

List all tags in the database

type Todo

type Todo struct {
	Id      int       `json:"id"`
	State   int       `json:"state"`
	TagId   int       `json:"tag_id"`
	OwnerId int       `json:"owner_id"`
	Public  bool      `json:"public"`
	Name    string    `json:"name"`
	DueDate time.Time `json:"due_date"`
	Desc    string    `json:"description"`
}

Represent a todo item

func ListAllTodos

func ListAllTodos(owner_id int) []Todo

List all viewable todos to the owner_id in the database

func (*Todo) InsertValues

func (todo *Todo) InsertValues() bool

Inserts a new todo. Returns true on success, false on error.

func (*Todo) ReadPermissions

func (todo *Todo) ReadPermissions() bool

Read in the only the owner and publicness of a todo id. Returns true if values were read.

func (*Todo) ReadValues

func (todo *Todo) ReadValues() bool

Read in the values of a todo based on id. Returns true if values were read.

func (*Todo) Remove

func (todo *Todo) Remove() bool

Remove a todo from the database based on Id. Returns true on successful removal.

func (*Todo) WriteValues

func (todo *Todo) WriteValues() bool

Updates an existing todo. Returns true on success, false on error.

type Token

type Token struct {
	Id      int    `json:"id"`
	Type    int    `json:"type"`
	Value   string `json:"value"`
	OwnerId int    `json:"owner_id"`
}

Represent a token

func (*Token) GenValue

func (token *Token) GenValue()

func (*Token) InsertValues

func (token *Token) InsertValues() bool

Inserts a new token. Returns true on success, false on error.

func (*Token) ReadValues

func (token *Token) ReadValues() bool

Read in the values of a token based on value. Returns true if values were read

func (*Token) Remove

func (token *Token) Remove() bool

Remove a token from the database based on Id. Returns true on successful removal.

type User

type User struct {
	Id   int    `json:"id"`
	Name string `json:"name"`
	// unhashed password
	PwdUH string `json:"password"`
}

Represent a user

func (*User) ReadValues

func (user *User) ReadValues() bool

Fetch user's ID based on username and password

Jump to

Keyboard shortcuts

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