database

package
v0.0.0-...-7cb78d9 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB interface {
	AddAdjective(word models.Adjective) error
	AddNoun(word models.Noun) error
	AddVerb(word models.Verb) error

	RemoveAdjective(id int) error
	RemoveNoun(id int) error
	RemoveVerb(id int) error

	GetAdjectiveIds() ([]int, error)
	GetNounIds(begin, end, alone bool) ([]int, error)
	GetVerbIds() ([]int, error)
	GetPronounIds(plural bool) ([]int, error)
	GetSentenceIds() ([]int, error)

	GetAdjective(id int) (*models.Adjective, error)
	GetNoun(id int) (*models.Noun, error)
	GetVerb(id int) (*models.Verb, error)
	GetPronoun(id int) (*models.Pronoun, error)
	GetSentence(id int) (string, error)

	InitData([]models.Adjective, []models.Noun, []models.Verb, []models.Pronoun, []string) error
	IsNew() bool
	Close()
}

func New

func New(databaseType DbType, connectionString string) (DB, error)

type DbType

type DbType string
const (
	DB_Json        DbType = "json"
	DB_PostgresSQL DbType = "pgsql"
	DB_SQLite      DbType = "sqlite"
)

Jump to

Keyboard shortcuts

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