database

package
v0.0.0-...-0eba841 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database struct {
	Documents DocumentsQuery
}

func NewDatabase

func NewDatabase(cfg string) *Database

type Document

type Document struct {
	Key     string  `json:"key"`
	Title   *string `json:"title"`
	Author  *string `json:"author"`
	Date    int     `json:"date"`
	Views   int     `json:"views"`
	Length  int     `json:"length"`
	Content string  `json:"content"`
}

type Documents

type Documents struct {
	*sqlx.DB
	// contains filtered or unexported fields
}

func NewDocuments

func NewDocuments(db *sqlx.DB) *Documents

func (*Documents) Exists

func (docs *Documents) Exists(key string) (exists bool, err error)

func (*Documents) IncrementViews

func (docs *Documents) IncrementViews(key, ip string)

func (*Documents) Insert

func (docs *Documents) Insert(title, author *string, content string) (doc *Document, err error)

func (*Documents) Select

func (docs *Documents) Select(key string) (doc *Document, err error)

type DocumentsQuery

type DocumentsQuery interface {
	Select(key string) (doc *Document, err error)
	Insert(title, author *string, content string) (doc *Document, err error)
	Exists(key string) (exists bool, err error)
	IncrementViews(key, ip string)
}

type ViewIPsKey

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

Jump to

Keyboard shortcuts

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