gen

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

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

Go to latest
Published: Dec 3, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const IterationsNum = 10

Number of generation iterations

Variables

This section is empty.

Functions

This section is empty.

Types

type Category

type Category struct {
	Id       uuid.UUID
	Name     string
	ParentId uuid.UUID
}

Category model...

type Gen

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

Gen model...

func New

func New(db *sql.DB) (*Gen, error)

New returns a new API instance

func (*Gen) GenerateRecords

func (gen *Gen) GenerateRecords()

GenerateRecords generates certain amount of users, categories and messages instances

func (*Gen) GenerateRootCategory

func (gen *Gen) GenerateRootCategory() error

writeRootCategory writes a root category in the db

func (*Gen) WriteCategories

func (gen *Gen) WriteCategories(total time.Duration) (time.Duration, error)

WriteCategories starts a new transaction with the DB and writes categories there

func (*Gen) WriteMessages

func (gen *Gen) WriteMessages(total time.Duration) (time.Duration, error)

WriteMessages starts a new transaction with the DB and writes messages there

func (*Gen) WriteUsers

func (gen *Gen) WriteUsers(total time.Duration) (time.Duration, error)

WriteUsers starts a new transaction with the DB and writes users there

type Message

type Message struct {
	Id         uuid.UUID
	Text       string
	CategoryId uuid.UUID
	PostedAt   time.Time
	AuthorId   uuid.UUID
}

Message model...

type User

type User struct {
	Id   uuid.UUID
	Name string
}

User model...

Jump to

Keyboard shortcuts

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