model

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2018 License: MIT Imports: 6 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 GiphysExtractor

type GiphysExtractor interface {
	ExtractContentsAndSearchAPI(s string) string
}

GiphysExtractor Interface for extracting a Giphy search

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

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) FindBySlug

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

FindBySlug Find a journal by slug

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