storage

package
v0.0.0-...-6860579 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2020 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultLang = "en"

DefaultLang -

Variables

View Source
var (
	// Cache -
	Cache = CacheStorage{}
)

Functions

func GetFileAt

func GetFileAt(path string) ([]byte, error)

GetFileAt -

func InitTreeFromRepo

func InitTreeFromRepo(repo string)

InitTreeFromRepo init the storage tree from github

func UpdateTreeFromRepo

func UpdateTreeFromRepo(repo string)

UpdateTreeFromRepo update the storage tree from github

Types

type Article

type Article struct {
	Lang      string     `json:"lang"`
	Title     string     `json:"title"`
	Name      string     `json:"name"`
	Tags      []string   `yaml:"tags" json:"tags"`
	Reftime   string     `yaml:"reftime" json:"refTime"`
	Intro     Section    `yaml:"intro" json:"intro"`
	Sections  []Section  `yaml:"sections" json:"sections"`
	Products  []Product  `yaml:"products" json:"products"`
	Sources   []Source   `yaml:"sources" json:"sources"`
	Reminders []Reminder `yaml:"reminders" json:"reminders"`
	Triggers  []Trigger  `yaml:"triggers" json:"triggers"`
}

Article -

type CacheStorage

type CacheStorage map[string]map[string]Tip

CacheStorage -

func (CacheStorage) Get

func (cs CacheStorage) Get(user, repo, branch, phase, stage, article, lang string) (Tip, bool)

Get -

func (CacheStorage) GetPathFromSlug

func (cs CacheStorage) GetPathFromSlug(user, repo, branch, slug string) (string, bool)

GetPathFromSlug -

func (CacheStorage) GetSlug

func (cs CacheStorage) GetSlug(user, repo, branch, slug, lang string) (Tip, bool)

GetSlug -

func (CacheStorage) List

func (cs CacheStorage) List(from, to int, user, repo, branch, phase, stage, article, lang string) []Tip

List -

func (CacheStorage) Push

func (cs CacheStorage) Push(tip Tip)

Push -

type Image

type Image struct {
	URL    string `yaml:"url" json:"url"`
	Layout string `yaml:"layout" json:"layout"`
}

Image -

type Link struct {
	Title string `yaml:"title" json:"title"`
	To    string `yaml:"to" json:"to"`
}

Link -

type Product

type Product struct {
	Name string `yaml:"name" json:"name"`
	Urls []struct {
		Zone  string `yaml:"zone" json:"zone"`
		Image string `yaml:"image" json:"image"`
		URL   string `yaml:"url" json:"URL"`
	}
}

Product -

type Reminder

type Reminder struct {
	Delay string `yaml:"delay"`
	Text  string `yaml:"text"`
	Next  string `yaml:"next"`
}

Reminder -

type Section

type Section struct {
	Title       string    `yaml:"title" json:"title"`
	Image       Image     `yaml:"image" json:"image"`
	Text        string    `yaml:"text"  json:"text"`
	SubSections []Section `yaml:"subsections" json:"subSections"`
	Link        Link      `yaml:"link" json:"link"`
}

Section -

type Source

type Source struct {
	Title string `yaml:"title" json:"title"`
	URL   string `yaml:"url" json:"URL"`
}

Source -

type Tip

type Tip struct {
	User    string  `json:"user"`
	Repo    string  `json:"repo"`
	Branch  string  `json:"branch"`
	Phase   string  `json:"phase"`
	Stage   string  `json:"stage"`
	Name    string  `json:"name"`
	Lang    string  `json:"lang"`
	Article Article `json:"article"`
}

Tip -

func NewTipForGithubRepo

func NewTipForGithubRepo(repo string) (Tip, error)

NewTipForGithubRepo -

type Trigger

type Trigger struct {
	ID     string `yaml:"id"`
	Metric string `yaml:"metric"`
	Value  string `yaml:"value"`
}

Trigger -

Jump to

Keyboard shortcuts

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