models

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PendingActivationTypeNewUser       = "newUser"
	PendingActivationTypeResetPassword = "resetPassword"
)

Variables

This section is empty.

Functions

func CopyFull

func CopyFull(target interface{}, source interface{})

func ProcessSlice

func ProcessSlice(current EditSlice, added EditSlice, removed EditSlice) error

Types

type BodyModification

type BodyModification struct {
	Location    string  `json:"location"`
	Description *string `json:"description"`
}

type BodyModificationInput

type BodyModificationInput = BodyModification

type Edit

type Edit struct {
	ID         uuid.UUID       `db:"id" json:"id"`
	UserID     uuid.UUID       `db:"user_id" json:"user_id"`
	TargetType string          `db:"target_type" json:"target_type"`
	Operation  string          `db:"operation" json:"operation"`
	VoteCount  int             `db:"votes" json:"votes"`
	Status     string          `db:"status" json:"status"`
	Applied    bool            `db:"applied" json:"applied"`
	Data       types.JSONText  `db:"data" json:"data"`
	CreatedAt  SQLiteTimestamp `db:"created_at" json:"created_at"`
	UpdatedAt  SQLiteTimestamp `db:"updated_at" json:"updated_at"`
}

func NewEdit

func NewEdit(UUID uuid.UUID, user *User, targetType TargetTypeEnum, input *EditInput) *Edit

func (*Edit) GetData

func (e *Edit) GetData() *EditData

func (Edit) GetID

func (e Edit) GetID() uuid.UUID

func (*Edit) GetPerformerData

func (e *Edit) GetPerformerData() (*PerformerEditData, error)

func (*Edit) GetTagData

func (e *Edit) GetTagData() (*TagEditData, error)

func (*Edit) ImmediateAccept

func (e *Edit) ImmediateAccept()

func (*Edit) ImmediateReject

func (e *Edit) ImmediateReject()

func (*Edit) SetData

func (e *Edit) SetData(data interface{}) error

type EditComment

type EditComment struct {
	ID        uuid.UUID       `db:"id" json:"id"`
	EditID    uuid.UUID       `db:"edit_id" json:"edit_id"`
	UserID    uuid.UUID       `db:"user_id" json:"user_id"`
	CreatedAt SQLiteTimestamp `db:"created_at" json:"created_at"`
	Text      string          `db:"text" json:"text"`
}

func NewEditComment

func NewEditComment(UUID uuid.UUID, user *User, edit *Edit, text string) *EditComment

type EditComments

type EditComments []*EditComment

func (*EditComments) Add

func (p *EditComments) Add(o interface{})

func (EditComments) Each

func (p EditComments) Each(fn func(interface{}))

type EditData

type EditData struct {
	New          *json.RawMessage `json:"new_data,omitempty"`
	Old          *json.RawMessage `json:"old_data,omitempty"`
	MergeSources []string         `json:"merge_sources,omitempty"`
}

type EditPerformer

type EditPerformer struct {
	EditID      uuid.UUID `db:"edit_id" json:"edit_id"`
	PerformerID uuid.UUID `db:"performer_id" json:"performer_id"`
}

type EditPerformers

type EditPerformers []*EditPerformer

func (*EditPerformers) Add

func (p *EditPerformers) Add(o interface{})

func (EditPerformers) Each

func (p EditPerformers) Each(fn func(interface{}))

type EditRepo

type EditRepo interface {
	Create(newEdit Edit) (*Edit, error)
	Update(updatedEdit Edit) (*Edit, error)
	Destroy(id uuid.UUID) error
	Find(id uuid.UUID) (*Edit, error)
	CreateEditTag(newJoin EditTag) error
	CreateEditPerformer(newJoin EditPerformer) error
	FindTagID(id uuid.UUID) (*uuid.UUID, error)
	FindPerformerID(id uuid.UUID) (*uuid.UUID, error)
	Count() (int, error)
	Query(editFilter *EditFilterType, findFilter *QuerySpec) ([]*Edit, int)
	CreateComment(newJoin EditComment) error
	GetComments(id uuid.UUID) (EditComments, error)
	FindByTagID(id uuid.UUID) ([]*Edit, error)
	FindByPerformerID(id uuid.UUID) ([]*Edit, error)
}

type EditSlice

type EditSlice interface {
	Each(fn func(interface{}))
	EachPtr(fn func(interface{}))
	Add(o interface{})
	Remove(v string)
}

type EditSliceValue

type EditSliceValue interface {
	ID() string
}

type EditTag

type EditTag struct {
	EditID uuid.UUID `db:"edit_id" json:"edit_id"`
	TagID  uuid.UUID `db:"tag_id" json:"tag_id"`
}

type EditTags

type EditTags []*EditTag

func (*EditTags) Add

func (p *EditTags) Add(o interface{})

func (EditTags) Each

func (p EditTags) Each(fn func(interface{}))

type Edits

type Edits []*Edit

func (*Edits) Add

func (p *Edits) Add(o interface{})

func (Edits) Each

func (p Edits) Each(fn func(interface{}))

type Image

type Image struct {
	ID        uuid.UUID      `db:"id" json:"id"`
	RemoteURL sql.NullString `db:"url" json:"url"`
	Checksum  string         `db:"checksum" json:"checksum"`
	Width     int64          `db:"width" json:"width"`
	Height    int64          `db:"height" json:"height"`
}

func (*Image) CopyFromCreateInput

func (p *Image) CopyFromCreateInput(input ImageCreateInput)

func (*Image) CopyFromUpdateInput

func (p *Image) CopyFromUpdateInput(input ImageUpdateInput)

func (Image) GetID

func (p Image) GetID() uuid.UUID

func (*Image) IsEditTarget

func (p *Image) IsEditTarget()

type ImageCreator

type ImageCreator interface {
	Create(newImage Image) (*Image, error)
}

type ImageDestroyer

type ImageDestroyer interface {
	Destroy(id uuid.UUID) error
}

type ImageFinder

type ImageFinder interface {
	Find(id uuid.UUID) (*Image, error)
	FindByChecksum(checksum string) (*Image, error)
	FindByPerformerID(performerID uuid.UUID) (Images, error)
	FindUnused() ([]*Image, error)
	IsUnused(imageID uuid.UUID) (bool, error)
}

type ImageRepo

type ImageRepo interface {
	ImageCreator
	ImageDestroyer
	ImageFinder

	FindByIds(ids []uuid.UUID) ([]*Image, []error)
	FindIdsBySceneIds(ids []uuid.UUID) ([][]uuid.UUID, []error)
	FindIdsByPerformerIds(ids []uuid.UUID) ([][]uuid.UUID, []error)
	FindBySceneID(sceneID uuid.UUID) ([]*Image, error)
	FindByPerformerID(performerID uuid.UUID) (Images, error)
	FindByStudioID(studioID uuid.UUID) ([]*Image, error)
	FindIdsByStudioIds(ids []uuid.UUID) ([][]uuid.UUID, []error)
}

type Images

type Images []*Image

func (*Images) Add

func (p *Images) Add(o interface{})

func (Images) Each

func (p Images) Each(fn func(interface{}))

func (Images) OrderLandscape

func (p Images) OrderLandscape()

func (Images) OrderPortrait

func (p Images) OrderPortrait()

func (Images) ToURLSlice

func (p Images) ToURLSlice() []string

type InviteKey

type InviteKey struct {
	ID          uuid.UUID       `db:"id" json:"id"`
	GeneratedBy uuid.UUID       `db:"generated_by" json:"generated_by"`
	GeneratedAt SQLiteTimestamp `db:"generated_at" json:"generated_at"`
}

func (InviteKey) GetID

func (p InviteKey) GetID() uuid.UUID

type InviteKeyCreator

type InviteKeyCreator interface {
	Create(newKey InviteKey) (*InviteKey, error)
}

type InviteKeyDestroyer

type InviteKeyDestroyer interface {
	InviteKeyFinder
	Destroy(id uuid.UUID) error
}

type InviteKeyFinder

type InviteKeyFinder interface {
	Find(id uuid.UUID) (*InviteKey, error)
	FindActiveKeysForUser(userID uuid.UUID, expireTime time.Time) (InviteKeys, error)
}

type InviteKeyRepo

type InviteKeyRepo interface {
	InviteKeyFinder
	InviteKeyCreator
	InviteKeyDestroyer
}

type InviteKeys

type InviteKeys []*InviteKey

func (*InviteKeys) Add

func (p *InviteKeys) Add(o interface{})

func (InviteKeys) Each

func (p InviteKeys) Each(fn func(interface{}))

type JSONTime

type JSONTime struct {
	time.Time
}

func (*JSONTime) MarshalJSON

func (jt *JSONTime) MarshalJSON() ([]byte, error)

func (*JSONTime) UnmarshalJSON

func (jt *JSONTime) UnmarshalJSON(b []byte) (err error)

type JoinsRepo

type JoinsRepo interface {
	CreatePerformersScenes(newJoins PerformersScenes) error
	UpdatePerformersScenes(sceneID uuid.UUID, updatedJoins PerformersScenes) error
	DestroyPerformersScenes(sceneID uuid.UUID) error
	CreateScenesTags(newJoins ScenesTags) error
	UpdateScenesTags(sceneID uuid.UUID, updatedJoins ScenesTags) error
	DestroyScenesTags(sceneID uuid.UUID) error
	CreateScenesImages(newJoins ScenesImages) error
	UpdateScenesImages(sceneID uuid.UUID, updatedJoins ScenesImages) error
	DestroyScenesImages(sceneID uuid.UUID) error
	CreatePerformersImages(newJoins PerformersImages) error
	UpdatePerformersImages(performerID uuid.UUID, updatedJoins PerformersImages) error
	DestroyPerformersImages(performerID uuid.UUID) error
	CreateStudiosImages(newJoins StudiosImages) error
	UpdateStudiosImages(studioID uuid.UUID, updatedJoins StudiosImages) error
	DestroyStudiosImages(studioID uuid.UUID) error
}

type NotFoundError

type NotFoundError uuid.UUID

NotFoundError indicates that an object with the given id was not found.

func (NotFoundError) Error

func (e NotFoundError) Error() string

type PendingActivation

type PendingActivation struct {
	ID        uuid.UUID       `db:"id" json:"id"`
	Email     string          `db:"email" json:"email"`
	InviteKey uuid.NullUUID   `db:"invite_key" json:"invite_key"`
	Type      string          `db:"type" json:"type"`
	Time      SQLiteTimestamp `db:"time" json:"time"`
}

func (PendingActivation) GetID

func (p PendingActivation) GetID() uuid.UUID

type PendingActivationCreator

type PendingActivationCreator interface {
	Create(newActivation PendingActivation) (*PendingActivation, error)
}

type PendingActivationFinder

type PendingActivationFinder interface {
	Find(id uuid.UUID) (*PendingActivation, error)
	FindByEmail(email string, activationType string) (*PendingActivation, error)
	FindByInviteKey(key string, activationType string) (*PendingActivation, error)
}

type PendingActivationRepo

type PendingActivationRepo interface {
	PendingActivationFinder
	PendingActivationCreator

	Destroy(id uuid.UUID) error
	DestroyExpired(expireTime time.Time) error
	Count() (int, error)
}

type PendingActivations

type PendingActivations []*PendingActivation

func (*PendingActivations) Add

func (p *PendingActivations) Add(o interface{})

func (PendingActivations) Each

func (p PendingActivations) Each(fn func(interface{}))

type Performer

type Performer struct {
	ID                uuid.UUID       `db:"id" json:"id"`
	Name              string          `db:"name" json:"name"`
	Disambiguation    sql.NullString  `db:"disambiguation" json:"disambiguation"`
	Gender            sql.NullString  `db:"gender" json:"gender"`
	Birthdate         SQLiteDate      `db:"birthdate" json:"birthdate"`
	BirthdateAccuracy sql.NullString  `db:"birthdate_accuracy" json:"birthdate_accuracy"`
	Ethnicity         sql.NullString  `db:"ethnicity" json:"ethnicity"`
	Country           sql.NullString  `db:"country" json:"country"`
	EyeColor          sql.NullString  `db:"eye_color" json:"eye_color"`
	HairColor         sql.NullString  `db:"hair_color" json:"hair_color"`
	Height            sql.NullInt64   `db:"height" json:"height"`
	CupSize           sql.NullString  `db:"cup_size" json:"cup_size"`
	BandSize          sql.NullInt64   `db:"band_size" json:"band_size"`
	WaistSize         sql.NullInt64   `db:"waist_size" json:"waist_size"`
	HipSize           sql.NullInt64   `db:"hip_size" json:"hip_size"`
	BreastType        sql.NullString  `db:"breast_type" json:"breast_type"`
	CareerStartYear   sql.NullInt64   `db:"career_start_year" json:"career_start_year"`
	CareerEndYear     sql.NullInt64   `db:"career_end_year" json:"career_end_year"`
	CreatedAt         SQLiteTimestamp `db:"created_at" json:"created_at"`
	UpdatedAt         SQLiteTimestamp `db:"updated_at" json:"updated_at"`
	Deleted           bool            `db:"deleted" json:"deleted"`
}

func (*Performer) CopyFromCreateInput

func (p *Performer) CopyFromCreateInput(input PerformerCreateInput) error

func (*Performer) CopyFromPerformerEdit

func (p *Performer) CopyFromPerformerEdit(input PerformerEdit, old PerformerEdit)

func (*Performer) CopyFromUpdateInput

func (p *Performer) CopyFromUpdateInput(input PerformerUpdateInput) error

func (Performer) GetID

func (p Performer) GetID() uuid.UUID

func (*Performer) IsEditTarget

func (p *Performer) IsEditTarget()

func (Performer) ResolveBirthdate

func (p Performer) ResolveBirthdate() FuzzyDate

func (Performer) ResolveMeasurements

func (p Performer) ResolveMeasurements() Measurements

func (*Performer) ValidateModifyEdit

func (p *Performer) ValidateModifyEdit(edit PerformerEditData) error

type PerformerAlias

type PerformerAlias struct {
	PerformerID uuid.UUID `db:"performer_id" json:"performer_id"`
	Alias       string    `db:"alias" json:"alias"`
}

func (PerformerAlias) ID

func (p PerformerAlias) ID() string

type PerformerAliases

type PerformerAliases []*PerformerAlias

func CreatePerformerAliases

func CreatePerformerAliases(performerID uuid.UUID, aliases []string) PerformerAliases

func (*PerformerAliases) Add

func (p *PerformerAliases) Add(o interface{})

func (*PerformerAliases) AddAliases

func (p *PerformerAliases) AddAliases(newAliases []*PerformerAlias) error

func (PerformerAliases) Each

func (p PerformerAliases) Each(fn func(interface{}))

func (PerformerAliases) EachPtr

func (p PerformerAliases) EachPtr(fn func(interface{}))

func (*PerformerAliases) Remove

func (p *PerformerAliases) Remove(id string)

func (*PerformerAliases) RemoveAliases

func (p *PerformerAliases) RemoveAliases(oldAliases []string) error

func (PerformerAliases) ToAliases

func (p PerformerAliases) ToAliases() []string

type PerformerBodyMod

type PerformerBodyMod struct {
	PerformerID uuid.UUID      `db:"performer_id" json:"performer_id"`
	Location    string         `db:"location" json:"location"`
	Description sql.NullString `db:"description" json:"description"`
}

func (PerformerBodyMod) ID

func (m PerformerBodyMod) ID() string

func (PerformerBodyMod) ToBodyModification

func (m PerformerBodyMod) ToBodyModification() BodyModification

type PerformerBodyMods

type PerformerBodyMods []*PerformerBodyMod

func CreatePerformerBodyMods

func CreatePerformerBodyMods(performerID uuid.UUID, urls []*BodyModification) PerformerBodyMods

func (*PerformerBodyMods) Add

func (p *PerformerBodyMods) Add(o interface{})

func (PerformerBodyMods) Each

func (p PerformerBodyMods) Each(fn func(interface{}))

func (PerformerBodyMods) EachPtr

func (p PerformerBodyMods) EachPtr(fn func(interface{}))

func (*PerformerBodyMods) Remove

func (p *PerformerBodyMods) Remove(id string)

func (PerformerBodyMods) ToBodyModifications

func (p PerformerBodyMods) ToBodyModifications() []*BodyModification

type PerformerEdit

type PerformerEdit struct {
	Name              *string             `json:"name,omitempty"`
	Disambiguation    *string             `json:"disambiguation,omitempty"`
	AddedAliases      []string            `json:"added_aliases,omitempty"`
	RemovedAliases    []string            `json:"removed_aliases,omitempty"`
	Gender            *string             `json:"gender,omitempty"`
	AddedUrls         []*URL              `json:"added_urls,omitempty"`
	RemovedUrls       []*URL              `json:"removed_urls,omitempty"`
	Birthdate         *string             `json:"birthdate,omitempty"`
	BirthdateAccuracy *string             `json:"birthdate_accuracy,omitempty"`
	Ethnicity         *string             `json:"ethnicity,omitempty"`
	Country           *string             `json:"country,omitempty"`
	EyeColor          *string             `json:"eye_color,omitempty"`
	HairColor         *string             `json:"hair_color,omitempty"`
	Height            *int64              `json:"height,omitempty"`
	CupSize           *string             `json:"cup_size,omitempty"`
	BandSize          *int64              `json:"band_size,omitempty"`
	WaistSize         *int64              `json:"waist_size,omitempty"`
	HipSize           *int64              `json:"hip_size,omitempty"`
	BreastType        *string             `json:"breast_type,omitempty"`
	CareerStartYear   *int64              `json:"career_start_year,omitempty"`
	CareerEndYear     *int64              `json:"career_end_year,omitempty"`
	AddedTattoos      []*BodyModification `json:"added_tattoos,omitempty"`
	RemovedTattoos    []*BodyModification `json:"removed_tattoos,omitempty"`
	AddedPiercings    []*BodyModification `json:"added_piercings,omitempty"`
	RemovedPiercings  []*BodyModification `json:"removed_piercings,omitempty"`
	AddedImages       []string            `json:"added_images,omitempty"`
	RemovedImages     []string            `json:"removed_images,omitempty"`
}

func (PerformerEdit) IsEditDetails

func (PerformerEdit) IsEditDetails()

type PerformerEditData

type PerformerEditData struct {
	New              *PerformerEdit `json:"new_data,omitempty"`
	Old              *PerformerEdit `json:"old_data,omitempty"`
	MergeSources     []string       `json:"merge_sources,omitempty"`
	SetModifyAliases bool           `json:"modify_aliases,omitempty"`
	SetMergeAliases  bool           `json:"merge_aliases,omitempty"`
}

type PerformerImage

type PerformerImage struct {
	PerformerID uuid.UUID `db:"performer_id" json:"performer_id"`
	ImageID     uuid.UUID `db:"image_id" json:"image_id"`
}

func (PerformerImage) ID

func (p PerformerImage) ID() string

type PerformerRedirect

type PerformerRedirect struct {
	SourceID uuid.UUID `db:"source_id" json:"source_id"`
	TargetID uuid.UUID `db:"target_id" json:"target_id"`
}

type PerformerRedirects

type PerformerRedirects []*PerformerRedirect

func (*PerformerRedirects) Add

func (p *PerformerRedirects) Add(o interface{})

func (PerformerRedirects) Each

func (p PerformerRedirects) Each(fn func(interface{}))

type PerformerRepo

type PerformerRepo interface {
	Create(newPerformer Performer) (*Performer, error)
	Update(updatedPerformer Performer) (*Performer, error)
	UpdatePartial(updatedPerformer Performer) (*Performer, error)
	Destroy(id uuid.UUID) error
	CreateAliases(newJoins PerformerAliases) error
	UpdateAliases(performerID uuid.UUID, updatedJoins PerformerAliases) error
	CreateUrls(newJoins PerformerURLs) error
	CreateImages(newJoins PerformersImages) error
	UpdateImages(performerID uuid.UUID, updatedJoins PerformersImages) error
	UpdateUrls(performerID uuid.UUID, updatedJoins PerformerURLs) error
	CreateTattoos(newJoins PerformerBodyMods) error
	UpdateTattoos(performerID uuid.UUID, updatedJoins PerformerBodyMods) error
	CreatePiercings(newJoins PerformerBodyMods) error
	UpdatePiercings(performerID uuid.UUID, updatedJoins PerformerBodyMods) error
	Find(id uuid.UUID) (*Performer, error)
	FindByIds(ids []uuid.UUID) ([]*Performer, []error)
	FindBySceneID(sceneID uuid.UUID) (Performers, error)
	FindByNames(names []string) (Performers, error)
	FindByAliases(names []string) (Performers, error)
	FindByName(name string) (Performers, error)
	FindByAlias(name string) (Performers, error)
	Count() (int, error)
	Query(performerFilter *PerformerFilterType, findFilter *QuerySpec) ([]*Performer, int)
	GetAliases(id uuid.UUID) (PerformerAliases, error)
	GetImages(id uuid.UUID) (PerformersImages, error)
	GetAllAliases(ids []uuid.UUID) ([][]string, []error)
	GetURLs(id uuid.UUID) ([]*URL, error)
	GetAllURLs(ids []uuid.UUID) ([][]*URL, []error)
	GetTattoos(id uuid.UUID) (PerformerBodyMods, error)
	GetAllTattoos(ids []uuid.UUID) ([][]*BodyModification, []error)
	GetPiercings(id uuid.UUID) (PerformerBodyMods, error)
	GetAllPiercings(ids []uuid.UUID) ([][]*BodyModification, []error)
	SearchPerformers(term string, limit int) (Performers, error)
	DeleteScenePerformers(id uuid.UUID) error
	SoftDelete(performer Performer) (*Performer, error)
	CreateRedirect(newJoin PerformerRedirect) error
	UpdateRedirects(oldTargetID uuid.UUID, newTargetID uuid.UUID) error
	UpdateScenePerformers(oldPerformer *Performer, newTargetID uuid.UUID, setAliases bool) error
	UpdateScenePerformerAlias(performerID uuid.UUID, name string) error
	MergeInto(sourceID uuid.UUID, targetID uuid.UUID, setAliases bool) error
	ApplyEdit(edit Edit, operation OperationEnum, performer *Performer) (*Performer, error)
	ApplyModifyEdit(performer *Performer, data *PerformerEditData) (*Performer, error)
	FindMergeIDsByPerformerIDs(ids []uuid.UUID) ([][]uuid.UUID, []error)
}

type PerformerScene

type PerformerScene struct {
	PerformerID uuid.UUID      `db:"performer_id" json:"performer_id"`
	As          sql.NullString `db:"as" json:"as"`
	SceneID     uuid.UUID      `db:"scene_id" json:"scene_id"`
}

type PerformerStudio

type PerformerStudio struct {
	SceneCount int `db:"count" json:"scene_count"`
	Studio
}

type PerformerURL

type PerformerURL struct {
	PerformerID uuid.UUID `db:"performer_id" json:"performer_id"`
	URL         string    `db:"url" json:"url"`
	Type        string    `db:"type" json:"type"`
}

func (PerformerURL) ID

func (p PerformerURL) ID() string

func (*PerformerURL) ToURL

func (p *PerformerURL) ToURL() URL

type PerformerURLs

type PerformerURLs []*PerformerURL

func CreatePerformerURLs

func CreatePerformerURLs(performerID uuid.UUID, urls []*URL) PerformerURLs

func (*PerformerURLs) Add

func (p *PerformerURLs) Add(o interface{})

func (PerformerURLs) Each

func (p PerformerURLs) Each(fn func(interface{}))

func (PerformerURLs) EachPtr

func (p PerformerURLs) EachPtr(fn func(interface{}))

func (*PerformerURLs) Remove

func (p *PerformerURLs) Remove(id string)

type Performers

type Performers []*Performer

func (*Performers) Add

func (p *Performers) Add(o interface{})

func (Performers) Each

func (p Performers) Each(fn func(interface{}))

type PerformersImages

type PerformersImages []*PerformerImage

func CreatePerformerImages

func CreatePerformerImages(performerID uuid.UUID, imageIds []string) PerformersImages

func (*PerformersImages) Add

func (p *PerformersImages) Add(o interface{})

func (PerformersImages) Each

func (p PerformersImages) Each(fn func(interface{}))

func (PerformersImages) EachPtr

func (p PerformersImages) EachPtr(fn func(interface{}))

func (*PerformersImages) Remove

func (p *PerformersImages) Remove(id string)

type PerformersScenes

type PerformersScenes []*PerformerScene

func CreateScenePerformers

func CreateScenePerformers(sceneID uuid.UUID, appearances []*PerformerAppearanceInput) PerformersScenes

func (*PerformersScenes) Add

func (p *PerformersScenes) Add(o interface{})

func (PerformersScenes) Each

func (p PerformersScenes) Each(fn func(interface{}))

type Repo

type Repo interface {
	txn.State

	Image() ImageRepo

	Performer() PerformerRepo
	Scene() SceneRepo
	Studio() StudioRepo

	TagCategory() TagCategoryRepo
	Tag() TagRepo

	Edit() EditRepo

	Joins() JoinsRepo

	PendingActivation() PendingActivationRepo
	Invite() InviteKeyRepo
	User() UserRepo
}

type SQLiteDate

type SQLiteDate struct {
	String string
	Valid  bool
}

func (SQLiteDate) IsValid

func (t SQLiteDate) IsValid() bool

func (*SQLiteDate) Scan

func (t *SQLiteDate) Scan(value interface{}) error

Scan implements the Scanner interface.

func (SQLiteDate) Value

func (t SQLiteDate) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type SQLiteTimestamp

type SQLiteTimestamp struct {
	Timestamp time.Time
}

func (SQLiteTimestamp) IsValid

func (t SQLiteTimestamp) IsValid() bool

func (*SQLiteTimestamp) Scan

func (t *SQLiteTimestamp) Scan(value interface{}) error

Scan implements the Scanner interface.

func (SQLiteTimestamp) Value

func (t SQLiteTimestamp) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type Scene

type Scene struct {
	ID        uuid.UUID       `db:"id" json:"id"`
	Title     sql.NullString  `db:"title" json:"title"`
	Details   sql.NullString  `db:"details" json:"details"`
	Date      SQLiteDate      `db:"date" json:"date"`
	StudioID  uuid.NullUUID   `db:"studio_id,omitempty" json:"studio_id"`
	CreatedAt SQLiteTimestamp `db:"created_at" json:"created_at"`
	UpdatedAt SQLiteTimestamp `db:"updated_at" json:"updated_at"`
	Duration  sql.NullInt64   `db:"duration" json:"duration"`
	Director  sql.NullString  `db:"director" json:"director"`
	Deleted   bool            `db:"deleted" json:"deleted"`
}

func (*Scene) CopyFromCreateInput

func (p *Scene) CopyFromCreateInput(input SceneCreateInput)

func (*Scene) CopyFromUpdateInput

func (p *Scene) CopyFromUpdateInput(input SceneUpdateInput)

func (Scene) GetID

func (p Scene) GetID() uuid.UUID

func (*Scene) IsEditTarget

func (p *Scene) IsEditTarget()

type SceneFingerprint

type SceneFingerprint struct {
	SceneID     uuid.UUID       `db:"scene_id" json:"scene_id"`
	Hash        string          `db:"hash" json:"hash"`
	Algorithm   string          `db:"algorithm" json:"algorithm"`
	Duration    int             `db:"duration" json:"duration"`
	Submissions int             `db:"submissions" json:"submissions"`
	CreatedAt   SQLiteTimestamp `db:"created_at" json:"created_at"`
	UpdatedAt   SQLiteTimestamp `db:"updated_at" json:"updated_at"`
}

func (SceneFingerprint) ToFingerprint

func (p SceneFingerprint) ToFingerprint() *Fingerprint

type SceneFingerprints

type SceneFingerprints []*SceneFingerprint

func CreateSceneFingerprints

func CreateSceneFingerprints(sceneID uuid.UUID, fingerprints []*FingerprintEditInput) SceneFingerprints

func CreateSubmittedSceneFingerprints

func CreateSubmittedSceneFingerprints(sceneID uuid.UUID, fingerprints []*FingerprintInput) SceneFingerprints

func (*SceneFingerprints) Add

func (p *SceneFingerprints) Add(o interface{})

func (SceneFingerprints) Each

func (p SceneFingerprints) Each(fn func(interface{}))

func (SceneFingerprints) ToFingerprints

func (p SceneFingerprints) ToFingerprints() []*Fingerprint

type SceneImage

type SceneImage struct {
	SceneID uuid.UUID `db:"scene_id" json:"scene_id"`
	ImageID uuid.UUID `db:"image_id" json:"image_id"`
}

type SceneRepo

type SceneRepo interface {
	Create(newScene Scene) (*Scene, error)
	Update(updatedScene Scene) (*Scene, error)
	Destroy(id uuid.UUID) error
	CreateURLs(newJoins SceneURLs) error
	UpdateURLs(scene uuid.UUID, updatedJoins SceneURLs) error
	CreateFingerprints(newJoins SceneFingerprints) error
	UpdateFingerprints(sceneID uuid.UUID, updatedJoins SceneFingerprints) error
	Find(id uuid.UUID) (*Scene, error)
	FindByFingerprint(algorithm FingerprintAlgorithm, hash string) ([]*Scene, error)
	FindByFingerprints(fingerprints []string) ([]*Scene, error)
	FindByFullFingerprints(fingerprints []*FingerprintQueryInput) ([]*Scene, error)
	FindByTitle(name string) ([]*Scene, error)
	Count() (int, error)
	Query(sceneFilter *SceneFilterType, findFilter *QuerySpec) ([]*Scene, int)
	GetFingerprints(id uuid.UUID) ([]*Fingerprint, error)
	GetAllFingerprints(ids []uuid.UUID) ([][]*Fingerprint, []error)
	GetPerformers(id uuid.UUID) (PerformersScenes, error)
	GetAllAppearances(ids []uuid.UUID) ([]PerformersScenes, []error)
	GetURLs(id uuid.UUID) (SceneURLs, error)
	GetAllURLs(ids []uuid.UUID) ([][]*URL, []error)
	SearchScenes(term string, limit int) ([]*Scene, error)
	CountByPerformer(id uuid.UUID) (int, error)
}

type SceneTag

type SceneTag struct {
	SceneID uuid.UUID `db:"scene_id" json:"scene_id"`
	TagID   uuid.UUID `db:"tag_id" json:"tag_id"`
}

type SceneURL

type SceneURL struct {
	SceneID uuid.UUID `db:"scene_id" json:"scene_id"`
	URL     string    `db:"url" json:"url"`
	Type    string    `db:"type" json:"type"`
}

func (*SceneURL) ToURL

func (p *SceneURL) ToURL() URL

type SceneURLs

type SceneURLs []*SceneURL

func CreateSceneURLs

func CreateSceneURLs(sceneID uuid.UUID, urls []*URLInput) SceneURLs

func (*SceneURLs) Add

func (p *SceneURLs) Add(o interface{})

func (SceneURLs) Each

func (p SceneURLs) Each(fn func(interface{}))

type Scenes

type Scenes []*Scene

func (*Scenes) Add

func (p *Scenes) Add(o interface{})

func (Scenes) Each

func (p Scenes) Each(fn func(interface{}))

type ScenesImages

type ScenesImages []*SceneImage

func CreateSceneImages

func CreateSceneImages(sceneID uuid.UUID, imageIds []string) ScenesImages

func (*ScenesImages) Add

func (p *ScenesImages) Add(o interface{})

func (ScenesImages) Each

func (p ScenesImages) Each(fn func(interface{}))

type ScenesTags

type ScenesTags []*SceneTag

func CreateSceneTags

func CreateSceneTags(sceneID uuid.UUID, tagIds []string) ScenesTags

func (*ScenesTags) Add

func (p *ScenesTags) Add(o interface{})

func (ScenesTags) Each

func (p ScenesTags) Each(fn func(interface{}))

type Studio

type Studio struct {
	ID             uuid.UUID       `db:"id" json:"id"`
	Name           string          `db:"name" json:"name"`
	ParentStudioID uuid.NullUUID   `db:"parent_studio_id,omitempty" json:"parent_studio_id"`
	CreatedAt      SQLiteTimestamp `db:"created_at" json:"created_at"`
	UpdatedAt      SQLiteTimestamp `db:"updated_at" json:"updated_at"`
	Deleted        bool            `db:"deleted" json:"deleted"`
}

func (*Studio) CopyFromCreateInput

func (p *Studio) CopyFromCreateInput(input StudioCreateInput)

func (*Studio) CopyFromUpdateInput

func (p *Studio) CopyFromUpdateInput(input StudioUpdateInput)

func (Studio) GetID

func (p Studio) GetID() uuid.UUID

func (*Studio) IsEditTarget

func (p *Studio) IsEditTarget()

type StudioImage

type StudioImage struct {
	StudioID uuid.UUID `db:"studio_id" json:"studio_id"`
	ImageID  uuid.UUID `db:"image_id" json:"image_id"`
}

type StudioRepo

type StudioRepo interface {
	Create(newStudio Studio) (*Studio, error)
	Update(updatedStudio Studio) (*Studio, error)
	Destroy(id uuid.UUID) error
	CreateURLs(newJoins StudioURLs) error
	UpdateURLs(studioID uuid.UUID, updatedJoins StudioURLs) error
	Find(id uuid.UUID) (*Studio, error)
	FindBySceneID(sceneID int) (Studios, error)
	FindByNames(names []string) (Studios, error)
	FindByName(name string) (*Studio, error)
	FindByParentID(id uuid.UUID) (Studios, error)
	Count() (int, error)
	Query(studioFilter *StudioFilterType, findFilter *QuerySpec) (Studios, int)
	GetURLs(id uuid.UUID) (StudioURLs, error)
	GetAllURLs(ids []uuid.UUID) ([][]*URL, []error)
	CountByPerformer(performerID uuid.UUID) ([]*PerformerStudio, error)
}

type StudioURL

type StudioURL struct {
	StudioID uuid.UUID `db:"studio_id" json:"studio_id"`
	URL      string    `db:"url" json:"url"`
	Type     string    `db:"type" json:"type"`
}

func (*StudioURL) ToURL

func (p *StudioURL) ToURL() URL

type StudioURLs

type StudioURLs []*StudioURL

func CreateStudioURLs

func CreateStudioURLs(studioID uuid.UUID, urls []*URLInput) StudioURLs

func (*StudioURLs) Add

func (p *StudioURLs) Add(o interface{})

func (StudioURLs) Each

func (p StudioURLs) Each(fn func(interface{}))

type Studios

type Studios []*Studio

func (*Studios) Add

func (p *Studios) Add(o interface{})

func (Studios) Each

func (p Studios) Each(fn func(interface{}))

type StudiosImages

type StudiosImages []*StudioImage

func CreateStudioImages

func CreateStudioImages(studioID uuid.UUID, imageIds []string) StudiosImages

func (*StudiosImages) Add

func (p *StudiosImages) Add(o interface{})

func (StudiosImages) Each

func (p StudiosImages) Each(fn func(interface{}))

type Tag

type Tag struct {
	ID          uuid.UUID       `db:"id" json:"id"`
	Name        string          `db:"name" json:"name"`
	CategoryID  uuid.NullUUID   `db:"category_id" json:"category_id"`
	Description sql.NullString  `db:"description" json:"description"`
	CreatedAt   SQLiteTimestamp `db:"created_at" json:"created_at"`
	UpdatedAt   SQLiteTimestamp `db:"updated_at" json:"updated_at"`
	Deleted     bool            `db:"deleted" json:"deleted"`
}

func (*Tag) CopyFromCreateInput

func (p *Tag) CopyFromCreateInput(input TagCreateInput)

func (*Tag) CopyFromTagEdit

func (p *Tag) CopyFromTagEdit(input TagEdit, existing *TagEdit)

func (*Tag) CopyFromUpdateInput

func (p *Tag) CopyFromUpdateInput(input TagUpdateInput)

func (Tag) GetID

func (p Tag) GetID() uuid.UUID

func (*Tag) IsEditTarget

func (p *Tag) IsEditTarget()

func (*Tag) ValidateModifyEdit

func (p *Tag) ValidateModifyEdit(edit TagEditData) error

type TagAlias

type TagAlias struct {
	TagID uuid.UUID `db:"tag_id" json:"tag_id"`
	Alias string    `db:"alias" json:"alias"`
}

func CreateTagAliases

func CreateTagAliases(tagID uuid.UUID, aliases []string) []*TagAlias

type TagAliases

type TagAliases []*TagAlias

func (*TagAliases) Add

func (p *TagAliases) Add(o interface{})

func (*TagAliases) AddAliases

func (p *TagAliases) AddAliases(newAliases []*TagAlias) error

func (TagAliases) Each

func (p TagAliases) Each(fn func(interface{}))

func (*TagAliases) Remove

func (p *TagAliases) Remove(alias string)

func (*TagAliases) RemoveAliases

func (p *TagAliases) RemoveAliases(oldAliases []string) error

func (TagAliases) ToAliases

func (p TagAliases) ToAliases() []string

type TagCategories

type TagCategories []*TagCategory

func (*TagCategories) Add

func (p *TagCategories) Add(o interface{})

func (TagCategories) Each

func (p TagCategories) Each(fn func(interface{}))

type TagCategory

type TagCategory struct {
	ID          uuid.UUID       `db:"id" json:"id"`
	Name        string          `db:"name" json:"name"`
	Group       string          `db:"group" json:"group"`
	Description sql.NullString  `db:"description" json:"description"`
	CreatedAt   SQLiteTimestamp `db:"created_at" json:"created_at"`
	UpdatedAt   SQLiteTimestamp `db:"updated_at" json:"updated_at"`
}

func (*TagCategory) CopyFromCreateInput

func (p *TagCategory) CopyFromCreateInput(input TagCategoryCreateInput)

func (*TagCategory) CopyFromUpdateInput

func (p *TagCategory) CopyFromUpdateInput(input TagCategoryUpdateInput)

func (TagCategory) GetID

func (p TagCategory) GetID() uuid.UUID

type TagCategoryRepo

type TagCategoryRepo interface {
	Create(newCategory TagCategory) (*TagCategory, error)
	Update(updatedCategory TagCategory) (*TagCategory, error)
	Destroy(id uuid.UUID) error
	Find(id uuid.UUID) (*TagCategory, error)
	FindByIds(ids []uuid.UUID) ([]*TagCategory, []error)
	Query(findFilter *QuerySpec) ([]*TagCategory, int, error)
}

type TagEdit

type TagEdit struct {
	Name           *string  `json:"name,omitempty"`
	Description    *string  `json:"description,omitempty"`
	AddedAliases   []string `json:"added_aliases,omitempty"`
	RemovedAliases []string `json:"removed_aliases,omitempty"`
	CategoryID     *string  `json:"category_id,omitempty"`
}

func (TagEdit) IsEditDetails

func (TagEdit) IsEditDetails()

type TagEditData

type TagEditData struct {
	New          *TagEdit `json:"new_data,omitempty"`
	Old          *TagEdit `json:"old_data,omitempty"`
	MergeSources []string `json:"merge_sources,omitempty"`
}

type TagRedirect

type TagRedirect struct {
	SourceID uuid.UUID `db:"source_id" json:"source_id"`
	TargetID uuid.UUID `db:"target_id" json:"target_id"`
}

type TagRepo

type TagRepo interface {
	Create(newTag Tag) (*Tag, error)
	Update(updatedTag Tag) (*Tag, error)
	UpdatePartial(updatedTag Tag) (*Tag, error)
	Destroy(id uuid.UUID) error
	DeleteSceneTags(id uuid.UUID) error
	SoftDelete(tag Tag) (*Tag, error)
	CreateRedirect(newJoin TagRedirect) error
	UpdateRedirects(oldTargetID uuid.UUID, newTargetID uuid.UUID) error
	UpdateSceneTags(oldTargetID uuid.UUID, newTargetID uuid.UUID) error
	CreateAliases(newJoins TagAliases) error
	UpdateAliases(tagID uuid.UUID, updatedJoins TagAliases) error
	Find(id uuid.UUID) (*Tag, error)
	FindByNameOrAlias(name string) (*Tag, error)
	FindBySceneID(sceneID uuid.UUID) ([]*Tag, error)
	FindIdsBySceneIds(ids []uuid.UUID) ([][]uuid.UUID, []error)
	FindByIds(ids []uuid.UUID) ([]*Tag, []error)
	FindByNames(names []string) ([]*Tag, error)
	FindByAliases(names []string) ([]*Tag, error)
	FindByName(name string) (*Tag, error)
	FindByAlias(name string) ([]*Tag, error)
	Count() (int, error)
	Query(tagFilter *TagFilterType, findFilter *QuerySpec) ([]*Tag, int, error)
	GetRawAliases(id uuid.UUID) (TagAliases, error)
	GetAliases(id uuid.UUID) ([]string, error)
	MergeInto(sourceID uuid.UUID, targetID uuid.UUID) error
	ApplyEdit(edit Edit, operation OperationEnum, tag *Tag) (*Tag, error)
}

type Tags

type Tags []*Tag

func (*Tags) Add

func (p *Tags) Add(o interface{})

func (Tags) Each

func (p Tags) Each(fn func(interface{}))

type URL

type URL struct {
	URL  string `json:"url"`
	Type string `json:"type"`
}

type URLInput

type URLInput = URL

type User

type User struct {
	ID           uuid.UUID       `db:"id" json:"id"`
	Name         string          `db:"name" json:"name"`
	PasswordHash string          `db:"password_hash" json:"password_hash"`
	Email        string          `db:"email" json:"email"`
	APIKey       string          `db:"api_key" json:"api_key"`
	APICalls     int             `db:"api_calls" json:"api_calls"`
	InviteTokens int             `db:"invite_tokens" json:"invite_tokens"`
	InvitedByID  uuid.NullUUID   `db:"invited_by" json:"invited_by"`
	LastAPICall  SQLiteTimestamp `db:"last_api_call" json:"last_api_call"`
	CreatedAt    SQLiteTimestamp `db:"created_at" json:"created_at"`
	UpdatedAt    SQLiteTimestamp `db:"updated_at" json:"updated_at"`
}

func (*User) CopyFromCreateInput

func (p *User) CopyFromCreateInput(input UserCreateInput) error

func (*User) CopyFromUpdateInput

func (p *User) CopyFromUpdateInput(input UserUpdateInput) error

func (User) GetID

func (p User) GetID() uuid.UUID

func (User) IsPasswordCorrect

func (p User) IsPasswordCorrect(pw string) bool

func (*User) SetPasswordHash

func (p *User) SetPasswordHash(pw string) error

type UserFinder

type UserFinder interface {
	Find(id uuid.UUID) (*User, error)
	FindByName(name string) (*User, error)
	FindByEmail(email string) (*User, error)
}

UserFinder is an interface to find and update User objects.

type UserRepo

type UserRepo interface {
	UserFinder

	Create(newUser User) (*User, error)
	Update(updatedUser User) (*User, error)
	UpdateFull(updatedUser User) (*User, error)
	Destroy(id uuid.UUID) error
	CreateRoles(newJoins UserRoles) error
	UpdateRoles(studioID uuid.UUID, updatedJoins UserRoles) error

	Count() (int, error)
	Query(userFilter *UserFilterType, findFilter *QuerySpec) (Users, int)
	GetRoles(id uuid.UUID) (UserRoles, error)
}

type UserRole

type UserRole struct {
	UserID uuid.UUID `db:"user_id" json:"user_id"`
	Role   string    `db:"role" json:"role"`
}

type UserRoles

type UserRoles []*UserRole

func CreateUserRoles

func CreateUserRoles(userID uuid.UUID, roles []RoleEnum) UserRoles

func (*UserRoles) Add

func (p *UserRoles) Add(o interface{})

func (UserRoles) Each

func (p UserRoles) Each(fn func(interface{}))

func (UserRoles) ToRoles

func (p UserRoles) ToRoles() []RoleEnum

type Users

type Users []*User

func (*Users) Add

func (p *Users) Add(o interface{})

func (Users) Each

func (p Users) Each(fn func(interface{}))

Jump to

Keyboard shortcuts

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