database

package
v0.0.0-...-6d11654 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter interface {
	Connect() error
	Close() error

	CreateTodo(ctx context.Context, in *Todo) (*Todo, error)
	GetTodo(ctx context.Context, id string) (*Todo, error)
	UpdateTodo(ctx context.Context, in *Todo) (*Todo, error)
	DeleteTodo(ctx context.Context, id string) error
	ListTodos(ctx context.Context, offset int, limit int, filters *Filters) ([]Todo, int, int, error)
}

type Filters

type Filters struct {
	Done *bool `json:"done"`
}

type Todo

type Todo struct {
	Id        string     `json:"id" gorm:"primaryKey"`
	Title     string     `json:"title"`
	Body      string     `json:"body"`
	Author    string     `json:"author"`
	IsDone    *bool      `json:"is_done"`
	CreatedAt time.Time  `json:"created_at"`
	UpdatedAt time.Time  `json:"updated_at"`
	DeletedAt *time.Time `json:"deleted_at"`
}

Todo contains all the information associated to a user.

func NewTodo

func NewTodo() *Todo

NewTodo returns an Todo instance.

Directories

Path Synopsis
adapter

Jump to

Keyboard shortcuts

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