manager

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Copyright 2023 Oscar Triano García

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.package manager

Copyright 2023 Oscar Triano García

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.package manager

Create database if not exists Check database

Copyright 2023 Oscar Triano García

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.package manager

Copyright 2023 Oscar Triano García

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.package manager

Copyright 2023 Oscar Triano García

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.package manager

Index

Constants

View Source
const DB = "index.db"

Variables

View Source
var CSS_PATH string = filepath.Join("assets", "css")
View Source
var IMAGES_PATH string = filepath.Join("assets", "images")
View Source
var SCRIPTS_PATH string = filepath.Join("assets", "scripts")

Functions

func AddCSS

func AddCSS(db *sql.DB, filename string) error

func AddCategoriesToPost

func AddCategoriesToPost(db *sql.DB, filename string, categories common.Tags) error

func AddCategory

func AddCategory(db *sql.DB, name string) error

func AddPost

func AddPost(db *sql.DB, filename, title string) error

func AddScript

func AddScript(db *sql.DB, filename string) error

func AddTag

func AddTag(db *sql.DB, name string) error

func AddTagsToPost

func AddTagsToPost(db *sql.DB, filename string, tags common.Tags) error

func CreateTree

func CreateTree(path string) error

func DoesStringExistIn

func DoesStringExistIn(db *sql.DB, table, column, value string) (bool, error)

func GetCSS

func GetCSS(db *sql.DB) ([]string, error)

func GetCategories

func GetCategories(db *sql.DB) ([]string, error)

func GetCategoriesFromPost

func GetCategoriesFromPost(db *sql.DB, filename string) ([]string, error)

func GetLang

func GetLang(db *sql.DB) (string, error)

func GetLicense

func GetLicense(db *sql.DB) (string, error)

func GetPathDB

func GetPathDB(path string) string

func GetPostsPerPage

func GetPostsPerPage(db *sql.DB) (int64, error)

func GetScripts

func GetScripts(db *sql.DB) ([]string, error)

func GetTagsFromPost

func GetTagsFromPost(db *sql.DB, filename string) ([]string, error)

func GetTitle

func GetTitle(db *sql.DB) (string, error)

func InsertStringInto

func InsertStringInto(db *sql.DB, table, column, value string) error

func OpenDatabase

func OpenDatabase(path string) (*sql.DB, error)

func RemoveCSS

func RemoveCSS(db *sql.DB, filename string) error

func RemoveCategoriesFromPost

func RemoveCategoriesFromPost(db *sql.DB, filename string, tags common.Tags) error

func RemoveCategory

func RemoveCategory(db *sql.DB, name string) error

func RemovePost

func RemovePost(db *sql.DB, filename string) error

func RemoveScript

func RemoveScript(db *sql.DB, filename string) error

func RemoveStringFrom

func RemoveStringFrom(db *sql.DB, table, column, value string) error

func RemoveTag

func RemoveTag(db *sql.DB, name string) error

func RemoveTagsFromPost

func RemoveTagsFromPost(db *sql.DB, filename string, tags common.Tags) error

func SelectAllStringsFrom

func SelectAllStringsFrom(db *sql.DB, table, column string) ([]string, error)

func SetLang

func SetLang(db *sql.DB, lang string) error

func SetLicense

func SetLicense(db *sql.DB, license string) error

func SetPostsPerPage

func SetPostsPerPage(db *sql.DB, postsPerPage int64) error

func SetTitle

func SetTitle(db *sql.DB, title string) error

func UpdatePostTitleByFilename

func UpdatePostTitleByFilename(db *sql.DB, filename, title string) error

Types

type Config

type Config struct {
	Title        string
	License      string
	Lang         string
	OutputPath   string
	PostsPerPage int64
}

func GetConfig

func GetConfig(db *sql.DB) (Config, error)

type Post

type Post struct {
	Filename string
	Title    string
	Date     time.Time
	// contains filtered or unexported fields
}

func CreatePostFromRows

func CreatePostFromRows(rows *sql.Rows) (Post, error)

func GetPages

func GetPages(db *sql.DB) ([]Post, error)

GetPages returns posts with the tag "page" These special posts are used as pages for navigation.

func GetPostByFilename

func GetPostByFilename(db *sql.DB, filename string) (Post, error)

func (Post) Id

func (p Post) Id() int64

type PostsPage

type PostsPage struct {
	Number      int64
	Posts       []Post
	HasNext     bool
	HasPrevious bool
	Category    string
}

type PostsPages

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

func GetPostsPages

func GetPostsPages(db *sql.DB, postsPerPage int64, category string) (PostsPages, error)

func (*PostsPages) GetPostsFromCurrentPage

func (pp *PostsPages) GetPostsFromCurrentPage(db *sql.DB) (PostsPage, error)

func (PostsPages) Next

func (pp PostsPages) Next() bool

Jump to

Keyboard shortcuts

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