seed

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssembleDescription

func AssembleDescription(original string, history []HistoryEntryJSON,
	createdAt time.Time) (string, error)

AssembleDescription applies seed history entries to the original body.

func LoadAds

func LoadAds() error

LoadAds loads ad files into ads table

func LoadAll

func LoadAll() error

LoadAll loads all seed data into the database.

func LoadCategories

func LoadCategories() error

LoadCategories loads ad-category.json into categories

func LoadUsers

func LoadUsers() error

LoadUsers loads users from user.json into the users table

Types

type Ad struct {
	ID          int
	CategoryID  int
	Title       string
	Description string
	Price       float64
	CreatedAt   string
	UserID      int
	ImageCount  int
	Location    LocationData
}

Ad represents an ad for loading purposes

type CategoryFiles

type CategoryFiles struct {
	ID         int
	SeedAdFile string
	Facets     []string
}

CategoryFiles stores file information for a category

type HistoryEntryJSON

type HistoryEntryJSON struct {
	Label string `json:"label"`
	Body  string `json:"body"`
	At    string `json:"at"`
}

HistoryEntryJSON is one description edit-history block in seed ad files.

type LocationData

type LocationData struct {
	City      string  `json:"city"`
	AdminArea string  `json:"admin_area"`
	Country   string  `json:"country"`
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`
}

LocationData represents location data from ad JSON files

type SuggestionJSON

type SuggestionJSON struct {
	Label string `json:"label"`
	Value string `json:"value"`
}

SuggestionJSON is one description tag in seed ad files.

Jump to

Keyboard shortcuts

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