factory

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CredentialMods credentialMods

Credential has methods that act as mods for the CredentialTemplate

View Source
var FileMods fileMods

File has methods that act as mods for the FileTemplate

View Source
var ItemMods itemMods

Item has methods that act as mods for the ItemTemplate

View Source
var SchemaMigrationMods schemaMigrationMods

SchemaMigration has methods that act as mods for the SchemaMigrationTemplate

View Source
var UserMods userMods

User has methods that act as mods for the UserTemplate

Functions

This section is empty.

Types

type CredentialMod

type CredentialMod interface {
	Apply(context.Context, *CredentialTemplate)
}

type CredentialModFunc

type CredentialModFunc func(context.Context, *CredentialTemplate)

func (CredentialModFunc) Apply

type CredentialModSlice

type CredentialModSlice []CredentialMod

func (CredentialModSlice) Apply

type CredentialTemplate

type CredentialTemplate struct {
	CredID                func() string
	CredPublicKey         func() []byte
	SignCount             func() int32
	Transports            func() sql.Null[string]
	UserVerified          func() sql.Null[bool]
	BackupEligible        func() sql.Null[bool]
	BackupState           func() sql.Null[bool]
	AttestationObject     func() sql.Null[[]byte]
	AttestationClientData func() sql.Null[[]byte]
	CreatedAt             func() time.Time
	LastUsed              func() time.Time
	UserID                func() int32
	// contains filtered or unexported fields
}

CredentialTemplate is an object representing the database table. all columns are optional and should be set by mods

func (*CredentialTemplate) Apply

func (o *CredentialTemplate) Apply(ctx context.Context, mods ...CredentialMod)

Apply mods to the CredentialTemplate

func (CredentialTemplate) Build

Build returns an *models.Credential Related objects are also created and placed in the .R field NOTE: Objects are not inserted into the database. Use CredentialTemplate.Create

func (CredentialTemplate) BuildMany

func (o CredentialTemplate) BuildMany(number int) models.CredentialSlice

BuildMany returns an models.CredentialSlice Related objects are also created and placed in the .R field NOTE: Objects are not inserted into the database. Use CredentialTemplate.CreateMany

func (CredentialTemplate) BuildManySetter

func (o CredentialTemplate) BuildManySetter(number int) []*models.CredentialSetter

BuildManySetter returns an []*models.CredentialSetter this does nothing with the relationship templates

func (CredentialTemplate) BuildSetter

func (o CredentialTemplate) BuildSetter() *models.CredentialSetter

BuildSetter returns an *models.CredentialSetter this does nothing with the relationship templates

func (*CredentialTemplate) Create

Create builds a credential and inserts it into the database Relations objects are also inserted and placed in the .R field

func (CredentialTemplate) CreateMany

func (o CredentialTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.CredentialSlice, error)

CreateMany builds multiple credentials and inserts them into the database Relations objects are also inserted and placed in the .R field

func (CredentialTemplate) CreateManyOrFail

func (o CredentialTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.CredentialSlice

CreateManyOrFail builds multiple credentials and inserts them into the database Relations objects are also inserted and placed in the .R field It calls `tb.Fatal(err)` on the test/benchmark if an error occurs

func (*CredentialTemplate) CreateOrFail

func (o *CredentialTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.Credential

CreateOrFail builds a credential and inserts it into the database Relations objects are also inserted and placed in the .R field It calls `tb.Fatal(err)` on the test/benchmark if an error occurs

func (*CredentialTemplate) MustCreate

func (o *CredentialTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.Credential

MustCreate builds a credential and inserts it into the database Relations objects are also inserted and placed in the .R field panics if an error occurs

func (CredentialTemplate) MustCreateMany

func (o CredentialTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.CredentialSlice

MustCreateMany builds multiple credentials and inserts them into the database Relations objects are also inserted and placed in the .R field panics if an error occurs

type Factory

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

func New

func New() *Factory

func (*Factory) AddBaseCredentialMod

func (f *Factory) AddBaseCredentialMod(mods ...CredentialMod)

func (*Factory) AddBaseFileMod

func (f *Factory) AddBaseFileMod(mods ...FileMod)

func (*Factory) AddBaseItemMod

func (f *Factory) AddBaseItemMod(mods ...ItemMod)

func (*Factory) AddBaseSchemaMigrationMod

func (f *Factory) AddBaseSchemaMigrationMod(mods ...SchemaMigrationMod)

func (*Factory) AddBaseUserMod

func (f *Factory) AddBaseUserMod(mods ...UserMod)

func (*Factory) ClearBaseCredentialMods

func (f *Factory) ClearBaseCredentialMods()

func (*Factory) ClearBaseFileMods

func (f *Factory) ClearBaseFileMods()

func (*Factory) ClearBaseItemMods

func (f *Factory) ClearBaseItemMods()

func (*Factory) ClearBaseSchemaMigrationMods

func (f *Factory) ClearBaseSchemaMigrationMods()

func (*Factory) ClearBaseUserMods

func (f *Factory) ClearBaseUserMods()

func (*Factory) NewCredential

func (f *Factory) NewCredential(ctx context.Context, mods ...CredentialMod) *CredentialTemplate

func (*Factory) NewFile

func (f *Factory) NewFile(ctx context.Context, mods ...FileMod) *FileTemplate

func (*Factory) NewItem

func (f *Factory) NewItem(ctx context.Context, mods ...ItemMod) *ItemTemplate

func (*Factory) NewSchemaMigration

func (f *Factory) NewSchemaMigration(ctx context.Context, mods ...SchemaMigrationMod) *SchemaMigrationTemplate

func (*Factory) NewUser

func (f *Factory) NewUser(ctx context.Context, mods ...UserMod) *UserTemplate

type FileMod

type FileMod interface {
	Apply(context.Context, *FileTemplate)
}

type FileModFunc

type FileModFunc func(context.Context, *FileTemplate)

func (FileModFunc) Apply

func (f FileModFunc) Apply(ctx context.Context, n *FileTemplate)

type FileModSlice

type FileModSlice []FileMod

func (FileModSlice) Apply

func (mods FileModSlice) Apply(ctx context.Context, n *FileTemplate)

type FileTemplate

type FileTemplate struct {
	ID     func() int32
	Name   func() string
	Data   func() []byte
	UserID func() int32
	// contains filtered or unexported fields
}

FileTemplate is an object representing the database table. all columns are optional and should be set by mods

func (*FileTemplate) Apply

func (o *FileTemplate) Apply(ctx context.Context, mods ...FileMod)

Apply mods to the FileTemplate

func (FileTemplate) Build

func (o FileTemplate) Build() *models.File

Build returns an *models.File Related objects are also created and placed in the .R field NOTE: Objects are not inserted into the database. Use FileTemplate.Create

func (FileTemplate) BuildMany

func (o FileTemplate) BuildMany(number int) models.FileSlice

BuildMany returns an models.FileSlice Related objects are also created and placed in the .R field NOTE: Objects are not inserted into the database. Use FileTemplate.CreateMany

func (FileTemplate) BuildManySetter

func (o FileTemplate) BuildManySetter(number int) []*models.FileSetter

BuildManySetter returns an []*models.FileSetter this does nothing with the relationship templates

func (FileTemplate) BuildSetter

func (o FileTemplate) BuildSetter() *models.FileSetter

BuildSetter returns an *models.FileSetter this does nothing with the relationship templates

func (*FileTemplate) Create

func (o *FileTemplate) Create(ctx context.Context, exec bob.Executor) (*models.File, error)

Create builds a file and inserts it into the database Relations objects are also inserted and placed in the .R field

func (FileTemplate) CreateMany

func (o FileTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FileSlice, error)

CreateMany builds multiple files and inserts them into the database Relations objects are also inserted and placed in the .R field

func (FileTemplate) CreateManyOrFail

func (o FileTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FileSlice

CreateManyOrFail builds multiple files and inserts them into the database Relations objects are also inserted and placed in the .R field It calls `tb.Fatal(err)` on the test/benchmark if an error occurs

func (*FileTemplate) CreateOrFail

func (o *FileTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.File

CreateOrFail builds a file and inserts it into the database Relations objects are also inserted and placed in the .R field It calls `tb.Fatal(err)` on the test/benchmark if an error occurs

func (*FileTemplate) MustCreate

func (o *FileTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.File

MustCreate builds a file and inserts it into the database Relations objects are also inserted and placed in the .R field panics if an error occurs

func (FileTemplate) MustCreateMany

func (o FileTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FileSlice

MustCreateMany builds multiple files and inserts them into the database Relations objects are also inserted and placed in the .R field panics if an error occurs

type ItemMod

type ItemMod interface {
	Apply(context.Context, *ItemTemplate)
}

type ItemModFunc

type ItemModFunc func(context.Context, *ItemTemplate)

func (ItemModFunc) Apply

func (f ItemModFunc) Apply(ctx context.Context, n *ItemTemplate)

type ItemModSlice

type ItemModSlice []ItemMod

func (ItemModSlice) Apply

func (mods ItemModSlice) Apply(ctx context.Context, n *ItemTemplate)

type ItemTemplate

type ItemTemplate struct {
	ID          func() int32
	Name        func() string
	Added       func() time.Time
	Description func() string
	Price       func() float32
	Quantity    func() int32
	UserID      func() int32
	// contains filtered or unexported fields
}

ItemTemplate is an object representing the database table. all columns are optional and should be set by mods

func (*ItemTemplate) Apply

func (o *ItemTemplate) Apply(ctx context.Context, mods ...ItemMod)

Apply mods to the ItemTemplate

func (ItemTemplate) Build

func (o ItemTemplate) Build() *models.Item

Build returns an *models.Item Related objects are also created and placed in the .R field NOTE: Objects are not inserted into the database. Use ItemTemplate.Create

func (ItemTemplate) BuildMany

func (o ItemTemplate) BuildMany(number int) models.ItemSlice

BuildMany returns an models.ItemSlice Related objects are also created and placed in the .R field NOTE: Objects are not inserted into the database. Use ItemTemplate.CreateMany

func (ItemTemplate) BuildManySetter

func (o ItemTemplate) BuildManySetter(number int) []*models.ItemSetter

BuildManySetter returns an []*models.ItemSetter this does nothing with the relationship templates

func (ItemTemplate) BuildSetter

func (o ItemTemplate) BuildSetter() *models.ItemSetter

BuildSetter returns an *models.ItemSetter this does nothing with the relationship templates

func (*ItemTemplate) Create

func (o *ItemTemplate) Create(ctx context.Context, exec bob.Executor) (*models.Item, error)

Create builds a item and inserts it into the database Relations objects are also inserted and placed in the .R field

func (ItemTemplate) CreateMany

func (o ItemTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.ItemSlice, error)

CreateMany builds multiple items and inserts them into the database Relations objects are also inserted and placed in the .R field

func (ItemTemplate) CreateManyOrFail

func (o ItemTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.ItemSlice

CreateManyOrFail builds multiple items and inserts them into the database Relations objects are also inserted and placed in the .R field It calls `tb.Fatal(err)` on the test/benchmark if an error occurs

func (*ItemTemplate) CreateOrFail

func (o *ItemTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.Item

CreateOrFail builds a item and inserts it into the database Relations objects are also inserted and placed in the .R field It calls `tb.Fatal(err)` on the test/benchmark if an error occurs

func (*ItemTemplate) MustCreate

func (o *ItemTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.Item

MustCreate builds a item and inserts it into the database Relations objects are also inserted and placed in the .R field panics if an error occurs

func (ItemTemplate) MustCreateMany

func (o ItemTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.ItemSlice

MustCreateMany builds multiple items and inserts them into the database Relations objects are also inserted and placed in the .R field panics if an error occurs

type SchemaMigrationMod

type SchemaMigrationMod interface {
	Apply(context.Context, *SchemaMigrationTemplate)
}

type SchemaMigrationModFunc

type SchemaMigrationModFunc func(context.Context, *SchemaMigrationTemplate)

func (SchemaMigrationModFunc) Apply

type SchemaMigrationModSlice

type SchemaMigrationModSlice []SchemaMigrationMod

func (SchemaMigrationModSlice) Apply

type SchemaMigrationTemplate

type SchemaMigrationTemplate struct {
	Version func() string
	// contains filtered or unexported fields
}

SchemaMigrationTemplate is an object representing the database table. all columns are optional and should be set by mods

func (*SchemaMigrationTemplate) Apply

Apply mods to the SchemaMigrationTemplate

func (SchemaMigrationTemplate) Build

Build returns an *models.SchemaMigration Related objects are also created and placed in the .R field NOTE: Objects are not inserted into the database. Use SchemaMigrationTemplate.Create

func (SchemaMigrationTemplate) BuildMany

BuildMany returns an models.SchemaMigrationSlice Related objects are also created and placed in the .R field NOTE: Objects are not inserted into the database. Use SchemaMigrationTemplate.CreateMany

func (SchemaMigrationTemplate) BuildManySetter

func (o SchemaMigrationTemplate) BuildManySetter(number int) []*models.SchemaMigrationSetter

BuildManySetter returns an []*models.SchemaMigrationSetter this does nothing with the relationship templates

func (SchemaMigrationTemplate) BuildSetter

BuildSetter returns an *models.SchemaMigrationSetter this does nothing with the relationship templates

func (*SchemaMigrationTemplate) Create

Create builds a schemaMigration and inserts it into the database Relations objects are also inserted and placed in the .R field

func (SchemaMigrationTemplate) CreateMany

CreateMany builds multiple schemaMigrations and inserts them into the database Relations objects are also inserted and placed in the .R field

func (SchemaMigrationTemplate) CreateManyOrFail

func (o SchemaMigrationTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.SchemaMigrationSlice

CreateManyOrFail builds multiple schemaMigrations and inserts them into the database Relations objects are also inserted and placed in the .R field It calls `tb.Fatal(err)` on the test/benchmark if an error occurs

func (*SchemaMigrationTemplate) CreateOrFail

CreateOrFail builds a schemaMigration and inserts it into the database Relations objects are also inserted and placed in the .R field It calls `tb.Fatal(err)` on the test/benchmark if an error occurs

func (*SchemaMigrationTemplate) MustCreate

MustCreate builds a schemaMigration and inserts it into the database Relations objects are also inserted and placed in the .R field panics if an error occurs

func (SchemaMigrationTemplate) MustCreateMany

func (o SchemaMigrationTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.SchemaMigrationSlice

MustCreateMany builds multiple schemaMigrations and inserts them into the database Relations objects are also inserted and placed in the .R field panics if an error occurs

type UserMod

type UserMod interface {
	Apply(context.Context, *UserTemplate)
}

type UserModFunc

type UserModFunc func(context.Context, *UserTemplate)

func (UserModFunc) Apply

func (f UserModFunc) Apply(ctx context.Context, n *UserTemplate)

type UserModSlice

type UserModSlice []UserMod

func (UserModSlice) Apply

func (mods UserModSlice) Apply(ctx context.Context, n *UserTemplate)

type UserTemplate

type UserTemplate struct {
	ID               func() int32
	Username         func() string
	Password         func() string
	ProfilePictureID func() sql.Null[int32]
	WebauthnID       func() string
	// contains filtered or unexported fields
}

UserTemplate is an object representing the database table. all columns are optional and should be set by mods

func (*UserTemplate) Apply

func (o *UserTemplate) Apply(ctx context.Context, mods ...UserMod)

Apply mods to the UserTemplate

func (UserTemplate) Build

func (o UserTemplate) Build() *models.User

Build returns an *models.User Related objects are also created and placed in the .R field NOTE: Objects are not inserted into the database. Use UserTemplate.Create

func (UserTemplate) BuildMany

func (o UserTemplate) BuildMany(number int) models.UserSlice

BuildMany returns an models.UserSlice Related objects are also created and placed in the .R field NOTE: Objects are not inserted into the database. Use UserTemplate.CreateMany

func (UserTemplate) BuildManySetter

func (o UserTemplate) BuildManySetter(number int) []*models.UserSetter

BuildManySetter returns an []*models.UserSetter this does nothing with the relationship templates

func (UserTemplate) BuildSetter

func (o UserTemplate) BuildSetter() *models.UserSetter

BuildSetter returns an *models.UserSetter this does nothing with the relationship templates

func (*UserTemplate) Create

func (o *UserTemplate) Create(ctx context.Context, exec bob.Executor) (*models.User, error)

Create builds a user and inserts it into the database Relations objects are also inserted and placed in the .R field

func (UserTemplate) CreateMany

func (o UserTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.UserSlice, error)

CreateMany builds multiple users and inserts them into the database Relations objects are also inserted and placed in the .R field

func (UserTemplate) CreateManyOrFail

func (o UserTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.UserSlice

CreateManyOrFail builds multiple users and inserts them into the database Relations objects are also inserted and placed in the .R field It calls `tb.Fatal(err)` on the test/benchmark if an error occurs

func (*UserTemplate) CreateOrFail

func (o *UserTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.User

CreateOrFail builds a user and inserts it into the database Relations objects are also inserted and placed in the .R field It calls `tb.Fatal(err)` on the test/benchmark if an error occurs

func (*UserTemplate) MustCreate

func (o *UserTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.User

MustCreate builds a user and inserts it into the database Relations objects are also inserted and placed in the .R field panics if an error occurs

func (UserTemplate) MustCreateMany

func (o UserTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.UserSlice

MustCreateMany builds multiple users and inserts them into the database Relations objects are also inserted and placed in the .R field panics if an error occurs

Jump to

Keyboard shortcuts

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