manager

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	METADATA_FILE = ".metadata.db"
)

Variables

View Source
var (
	ErrIsDir      = errors.New("File is a directory.")
	ErrNotIndexed = errors.New("File is not indexed.")
	ErrNoValid    = errors.New("This file is not valid")
)

Functions

This section is empty.

Types

type Content

type Content struct {
	// contains filtered or unexported fields
}

func OpenContent

func OpenContent(base string) Content

func (Content) Categories

func (c Content) Categories() Set

func (Content) CheckInPagesFolder

func (c Content) CheckInPagesFolder(filename string) (bool, error)

func (Content) CheckInPostsFolder

func (c Content) CheckInPostsFolder(filename string) (bool, error)

func (Content) CreatePageMetadata

func (c Content) CreatePageMetadata(filename string) (int64, error)

func (Content) CreatePostMetadata

func (c Content) CreatePostMetadata(filename string) (int64, error)

func (Content) GetPageFile

func (c Content) GetPageFile(filename string) Page

func (Content) GetPageMetadata

func (c Content) GetPageMetadata(filename string) (Page, error)

func (Content) GetPages

func (c Content) GetPages() []Page

func (Content) GetPostFile

func (c Content) GetPostFile(filename string) Post

func (Content) GetPostMetadata

func (c Content) GetPostMetadata(filename string) (Post, error)

func (Content) GetPosts

func (c Content) GetPosts() []Post

func (Content) License

func (c Content) License() string

License returns the website license

func (Content) Output

func (c Content) Output() (output string)

Output returns the output path where the website is builded

func (Content) PostsPerPage

func (c Content) PostsPerPage() int

PostsPerPage returns the number of posts por pages stored in metadata

func (Content) SetLicense

func (c Content) SetLicense(license string) error

SetLicense sets the general license of the website contents

func (Content) SetOutput

func (c Content) SetOutput(output string) error

SetOutput changes the title of the website

func (Content) SetPostsPerPage

func (c Content) SetPostsPerPage(ppp int) error

SetPostsPerPage changes the posts for page when building a site

func (Content) SetTitle

func (c Content) SetTitle(title string) error

SetTitle changes the title of the website

func (Content) Title

func (c Content) Title() string

Title returns the title stored

type Element

type Element struct {
	// contains filtered or unexported fields
}

Element represents a member, or row, of the name which this belongs.

func (Element) Id

func (e Element) Id() int

func (Element) Name

func (e Element) Name() string

func (Element) PostIn

func (e Element) PostIn(post Post) bool

PostIn tells if a specific post is in this element as true or false

func (Element) Posts

func (e Element) Posts() []Post

func (Element) Set

func (e Element) Set() Set

Set returns its parent

type File

type File struct {
	// contains filtered or unexported fields
}

File is the base struct for Post and Page

func (File) Id

func (f File) Id() int64

func (File) IsValid

func (f File) IsValid() bool

func (File) Name

func (f File) Name() string

func (File) Path

func (f File) Path() string

func (*File) SetPath

func (f *File) SetPath(path string)

type Filer

type Filer interface {
	Fill(*sql.Row, string) error
	FillFromRows(*sql.Rows, string) error
	Id() int64
	Name() string
	Path() string
	Header() string
}

type Page

type Page struct {
	File
	// contains filtered or unexported fields
}

func (*Page) Fill

func (p *Page) Fill(row *sql.Row, basePath string) error

func (*Page) FillFromRows

func (p *Page) FillFromRows(rows *sql.Rows, basePath string) error

func (Page) Header

func (p Page) Header() string

func (*Page) SetReference

func (p *Page) SetReference(reference string) error

type Post

type Post struct {
	File
	// contains filtered or unexported fields
}

func (Post) Date

func (p Post) Date() time.Time

func (*Post) Fill

func (p *Post) Fill(row *sql.Row, basePath string) error

func (*Post) FillFromRows

func (p *Post) FillFromRows(rows *sql.Rows, basePath string) error

func (Post) Header

func (p Post) Header() string

func (Post) SetDate

func (p Post) SetDate(date string) error

type Set

type Set struct {
	// contains filtered or unexported fields
}

Set represents a table in database

func (Set) AddElement

func (s Set) AddElement(element string) (int64, error)

AddElement adds a new row, an element like a category or tag name

func (Set) AddPostForElement

func (s Set) AddPostForElement(post Post, element string) error

func (Set) DeleteUnusedElements

func (s Set) DeleteUnusedElements()

DeleteUnusedElements removes those elements without any post related

func (Set) Elements

func (s Set) Elements() []Element

func (Set) Name

func (s Set) Name() string

func (Set) RemovePostForElement

func (s Set) RemovePostForElement(post Post, element string) error

Jump to

Keyboard shortcuts

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