model

package
v0.9.6 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Slugify

func Slugify(s string) string

Slugify Utility to convert a string into a slug

Types

type Giphys

type Giphys struct {
	Container *app.Container
}

Giphys Common resource link for Giphy actions

func (*Giphys) ConvertIDsToIframes

func (gs *Giphys) ConvertIDsToIframes(s string) string

ConvertIDsToIframes Convert any IDs in the content into <iframe> embeds

func (*Giphys) ExtractContentsAndSearchAPI

func (gs *Giphys) ExtractContentsAndSearchAPI(s string) string

ExtractContentsAndSearchAPI Convert any searches, connecting to Giphy where required

type GiphysDisabled added in v0.2.2

type GiphysDisabled struct {
	Container *app.Container
}

GiphysDisabled Whne no API key available, perform no action

func (*GiphysDisabled) ExtractContentsAndSearchAPI added in v0.2.2

func (gs *GiphysDisabled) ExtractContentsAndSearchAPI(s string) string

ExtractContentsAndSearchAPI Perform no action without an API key

type GiphysExtractor

type GiphysExtractor interface {
	ExtractContentsAndSearchAPI(s string) string
}

GiphysExtractor Interface for extracting a Giphy search

func GiphyAdapter added in v0.2.2

func GiphyAdapter(c *app.Container) GiphysExtractor

GiphyAdapter Get the correct adapter to use depending on wither an API key is available

type Journal

type Journal struct {
	ID      int    `json:"id"`
	Slug    string `json:"slug"`
	Title   string `json:"title"`
	Date    string `json:"date"`
	Content string `json:"content"`
}

Journal model

func (Journal) GetDate

func (j Journal) GetDate() string

GetDate Get the friendly date for the Journal

func (Journal) GetEditableDate

func (j Journal) GetEditableDate() string

GetEditableDate Get the date string for editing

func (Journal) GetExcerpt added in v0.4.1

func (j Journal) GetExcerpt() string

GetExcerpt returns a small extract of the entry

type Journals

type Journals struct {
	Container *app.Container
	Gs        GiphysExtractor
}

Journals Common database resource link for Journal actions

func (*Journals) CreateTable

func (js *Journals) CreateTable() error

CreateTable Create the actual table

func (*Journals) EnsureUniqueSlug

func (js *Journals) EnsureUniqueSlug(slug string, addition int) string

EnsureUniqueSlug Make sure the current slug is unique

func (*Journals) FetchAll

func (js *Journals) FetchAll() []Journal

FetchAll Get all journals

func (*Journals) FetchPaginated added in v0.4.1

func (js *Journals) FetchPaginated(query database.PaginationQuery) ([]Journal, database.PaginationInformation)

FetchPaginated returns a set of paginated journal entries

func (*Journals) FindBySlug

func (js *Journals) FindBySlug(slug string) Journal

FindBySlug Find a journal by slug

func (*Journals) FindNext added in v0.4.1

func (js *Journals) FindNext(id int) Journal

FindNext returns the next entry after an ID

func (*Journals) FindPrev added in v0.4.1

func (js *Journals) FindPrev(id int) Journal

FindNext returns the previous entry before an ID

func (*Journals) Save

func (js *Journals) Save(j Journal) Journal

Save Save a journal entry, either inserting it or updating it in the database

Jump to

Keyboard shortcuts

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