client

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateModel

func CreateModel() *model

CreateModel generates a text area for use in bubbletea.

func DeletePost

func DeletePost(ctx context.Context, key string) error

func SaveEntry

func SaveEntry(ctx context.Context, text string) error

func Sync

func Sync(ctx context.Context) error

func TimeSinceLastPost

func TimeSinceLastPost(ctx context.Context) (time.Duration, error)

Types

type Post

type Post struct {
	gorm.Model

	ID        uuid.UUID `gorm:"type:uuid;primary_key;"`
	Content   string
	CreatedAt time.Time `sql:"index"`
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
}

func GetPost

func GetPost(ctx context.Context, key string) (*Post, error)

func ListPosts

func ListPosts(ctx context.Context, count int) ([]*Post, error)

func (*Post) BeforeCreate

func (p *Post) BeforeCreate(tx *gorm.DB) error

BeforeCreate will set a UUID as the primary key.

func (*Post) BeforeSave

func (p *Post) BeforeSave(tx *gorm.DB) error

Jump to

Keyboard shortcuts

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