gen

package
v0.0.0-...-69d9917 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: MIT, Unlicense Imports: 12 Imported by: 0

Documentation

Overview

Package gen implements data generators for the chat kitchen.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenMessage

func GenMessage(
	user *model.User,
	content string,
	serial int,
	at time.Time,
	fetchImage func(image.Point) image.Image,
) model.Message

GenMessage generates a message with sensible defaults.

func GenRooms

func GenRooms(min, max int, fetchImage func(image.Point) image.Image) *model.Rooms

GenRooms generates a random number of rooms between min and max.

func GenUsers

func GenUsers(min, max int, fetchImage func(image.Point) image.Image) *model.Users

GenUsers will generate a random number of fake users.

func ToNRGBA

func ToNRGBA(c colorful.Color) color.NRGBA

ToNRGBA converts a colorful.Color to the nearest representable color.NRGBA.

Types

type Generator

type Generator struct {
	// FetchImage callback fetches an image of the given size.
	FetchImage func(image.Point) image.Image
	// contains filtered or unexported fields
}

func (*Generator) GenHistoricMessage

func (g *Generator) GenHistoricMessage(user *model.User) model.Message

GenHistoryMessage generates an old message that theoretically exists at some point in history.

func (*Generator) GenNewMessage

func (g *Generator) GenNewMessage(user *model.User, content string) model.Message

GenNewMessage generates a new message ready to be sent to the data model.

func (*Generator) GenRooms

func (g *Generator) GenRooms(min, max int) *model.Rooms

GenRooms generates some random number of rooms between min and max.

func (*Generator) GenUsers

func (g *Generator) GenUsers(min, max int) *model.Users

GenUsers generates some random number of users between min and max.

Jump to

Keyboard shortcuts

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