Search and commands

↑ ↓ to select · Enter to open · Esc to close

Type to search packages.

app

v1.1.18
modernc.org/sqlite-bench/app

Documentation

pkg.go.dev ↗

Table of contents

↓ to select · Enter to jump· Shift+Enter for source

28 matches

Top ↑

Functions

BindTime

func BindTime(v time.Time) int64

Must

func Must(c bool, format string, a ...any)

MustBe

func MustBe(c bool)

MustBeEqual

func MustBeEqual(a, b any)

MustBeNil

func MustBeNil(a any)

MustBeSet

func MustBeSet(a any)

Run

func Run(makeDb func(dbfile string) Db)

UnbindTime

func UnbindTime(v int64) time.Time

Types

Article

type Article struct {
	Id      int
	Created time.Time
	UserId  int // the user that wrote this article
	Text    string
}

Articles are created by Users.

NewArticle

func NewArticle(id int, created time.Time, userId int, text string) Article

Comment

type Comment struct {
	Id        int
	Created   time.Time
	ArticleId int // the article that this comment is for
	Text      string
}

Comments are written for Articles.

NewComment

func NewComment(id int, created time.Time, articleId int, text string) Comment

Db

type Db interface {
	DriverName() string
	Exec(sqls ...string)
	InsertUsers(insertSql string, users []User)
	InsertArticles(insertSql string, articles []Article)
	InsertComments(insertSql string, comments []Comment)
	FindUsers(querySql string) []User
	FindUsersArticlesComments(querySql string) ([]User, []Article, []Comment)
	Close()
}

Db is the database interface.

SqlDb

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

SqlDb is a Db implementation that uses database/sql package.

NewSqlDb

func NewSqlDb(driverName string, db *sql.DB) *SqlDb

SqlDb.Close

func (d *SqlDb) Close()

SqlDb.DriverName

func (d *SqlDb) DriverName() string

SqlDb.Exec

func (d *SqlDb) Exec(sqls ...string)

SqlDb.FindArticles

func (d *SqlDb) FindArticles(querySql string) []Article

SqlDb.FindUsers

func (d *SqlDb) FindUsers(querySql string) []User

SqlDb.FindUsersArticlesComments

func (d *SqlDb) FindUsersArticlesComments(querySql string) ([]User, []Article, []Comment)

SqlDb.InsertArticles

func (d *SqlDb) InsertArticles(insertSql string, articles []Article)

SqlDb.InsertComments

func (d *SqlDb) InsertComments(insertSql string, comments []Comment)

SqlDb.InsertUsers

func (d *SqlDb) InsertUsers(insertSql string, users []User)

User

type User struct {
	Id      int
	Created time.Time
	Email   string
	Active  bool
}

User is a registered User who can access the blog.

NewUser

func NewUser(id int, created time.Time, email string, active bool) User

Dependency graph