package test import ( "fmt" "math/rand" "git.anthrove.art/Anthrove/otter-space-sdk/v2/pkg/models" "github.com/davecgh/go-spew/spew" gonanoid "github.com/matoous/go-nanoid/v2" ) func GenerateRandomTags(numTags int) []models.Tag { var tags []models.Tag tagTypes := []models.TagType{"general", "species", "character", "artist", "lore", "meta", "invalid", "copyright"} for i := 0; i < numTags; i++ { id, _ := gonanoid.New(10) tagName := spew.Sprintf("tag_name_%s", id) tagType := tagTypes[rand.Intn(len(tagTypes))] tag := models.Tag{ Name: models.TagName(tagName), Type: tagType, } tags = append(tags, tag) } return tags } func GenerateRandomTagGroups(tags []models.Tag, numGroups int) []models.TagGroup { var tagGroups []models.TagGroup for i := 0; i < numGroups; i++ { id, _ := gonanoid.New(10) groupName := fmt.Sprintf("tag_group_%s", id) randomTag := tags[rand.Intn(len(tags))] tagGroup := models.TagGroup{ Name: models.TagGroupName(groupName), TagID: randomTag.Name, } tagGroups = append(tagGroups, tagGroup) } return tagGroups } func GenerateRandomTagAlias(tags []models.Tag, numGroups int) []models.TagAlias { var tagAliases []models.TagAlias for i := 0; i < numGroups; i++ { id, _ := gonanoid.New(10) groupName := fmt.Sprintf("tag_alias_%s", id) randomTag := tags[rand.Intn(len(tags))] tagAlias := models.TagAlias{ Name: models.TagAliasName(groupName), TagID: randomTag.Name, } tagAliases = append(tagAliases, tagAlias) } return tagAliases }