helpers

package
v0.0.1-alpha.8 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// AppPath is the absolute path to the app
	AppPath string

	// WorkPath is the absolute path to project root directory
	WorkPath string
)
View Source
var Conf struct {
	DeveloperMode bool
	EnableAdmin   bool
	AdminHost     string
	YelakPath     string
	Data          map[string]string
}

Functions

func ConfGet

func ConfGet(key string) string

func ConfInit

func ConfInit()

func ConfTrim

func ConfTrim(str string, toLower bool) string

Types

type Assets

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

func (*Assets) AppendCSS

func (s *Assets) AppendCSS(key string, value string)

func (*Assets) AppendJS

func (s *Assets) AppendJS(key string, value string)

func (*Assets) CSS

func (s *Assets) CSS(key string) template.HTML

func (*Assets) Init

func (s *Assets) Init()

func (*Assets) JS

func (s *Assets) JS(key string) template.HTML
type BreadcrumbItem struct {
	Link string
	Name string
}

type DB

type DB struct{}

func (*DB) BulkInsert

func (m *DB) BulkInsert(table string, keys []string, valuesList [][]any) error

func (*DB) BulkUpdate

func (m *DB) BulkUpdate(table string, keys []string, keysToUpdate []string, valuesList [][]any) error

func (*DB) CloseDB

func (m *DB) CloseDB(db *sql.DB)

func (*DB) CloseResult

func (m *DB) CloseResult(result *sql.Rows)

func (*DB) FastCount

func (m *DB) FastCount(q string, args ...any) int

func (*DB) GenerateWhere

func (m *DB) GenerateWhere(where []string) string

func (*DB) GetData

func (m *DB) GetData(structData any, tags []string) ([]string, []any, error)

func (*DB) GetDataByWhere

func (m *DB) GetDataByWhere(structData any, where string, tags []string) ([]string, []any, error)

func (*DB) GetIDS

func (m *DB) GetIDS(strIDS string) []int

func (*DB) Insert

func (m *DB) Insert(table string, keys []string, values []any) (sql.Result, error)

func (*DB) MakeStrIDS

func (m *DB) MakeStrIDS(ids []int) string

func (*DB) Replace

func (m *DB) Replace(table string, keys []string, values []any) (sql.Result, error)

func (*DB) SelectOneByStruct

func (m *DB) SelectOneByStruct(table string, dbStruct any, sqlWHERE string, sqlOpt ...any)

func (*DB) SetupCH

func (m *DB) SetupCH() (*sql.DB, error)

SetupCH connect to ClickHouse

func (*DB) SetupDB

func (m *DB) SetupDB() (*sql.DB, error)

SetupDB connect to MariaDB

type Seo

type Seo struct {
	Breadcrumbs   []BreadcrumbItem
	Data          map[string]any
	CurrentURL    string
	CurrentDomain string
	SocialImage   string
}

func (*Seo) Breadcrumb

func (m *Seo) Breadcrumb(item BreadcrumbItem)

func (*Seo) Get

func (m *Seo) Get(key string) any

func (*Seo) Init

func (m *Seo) Init(currentURL string)

func (*Seo) IsBot

func (m *Seo) IsBot(Agent string) bool

func (*Seo) Set

func (m *Seo) Set(key string, value any)

func (*Seo) SetSocialImage

func (m *Seo) SetSocialImage(img string)

func (*Seo) SocialTags

func (m *Seo) SocialTags() template.HTML

func (*Seo) Tags

func (m *Seo) Tags() template.HTML

type Sitemap

type Sitemap struct {
	Err error
}

func (*Sitemap) GenerateIndex

func (s *Sitemap) GenerateIndex(sitemapLinks []string) string

func (*Sitemap) GenerateIndexFile

func (s *Sitemap) GenerateIndexFile(sitemapLinks []string, file string, perm os.FileMode) error

func (*Sitemap) GenerateSitemap

func (s *Sitemap) GenerateSitemap(pages []SitemapPage) string

func (*Sitemap) GenerateSitemapFile

func (s *Sitemap) GenerateSitemapFile(pages []SitemapPage, file string, perm os.FileMode) error

type SitemapPage

type SitemapPage struct {
	URL        string
	ChangeFreq string
	LastMod    string
	Priority   string
}

Jump to

Keyboard shortcuts

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