entity

package
v0.0.0-...-aef14cd Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: Unlicense Imports: 10 Imported by: 0

Documentation

Overview

Package entity TODO.

Package entity TODO.

Package entity TODO.

Package entity TODO.

Package entity TODO.

Package entity TODO.

Index

Constants

View Source
const (
	AssetSelectSQL = `` /* 180-byte string literal not displayed */

	AssetSelectByAssetTypeSQL = `` /* 238-byte string literal not displayed */

	AssetDeleteSQL = `UPDATE assets
	SET deleted = true
	WHERE isin = $1
	RETURNING deleted, updated_at`

	AssetDeleteTxSQL = `UPDATE assets
	SET deleted = true WHERE isin = $1
	RETURNING isin, asset_type, deleted, created_at, updated_at`

	AssetInsertSQL = `INSERT INTO assets
	(isin, asset_type, created_at)
	VALUES ($1, $2, $3)
	RETURNING isin, asset_type, created_at`

	AssetUpdateSQL = `UPDATE assets
	SET asset_type = $2, updated_at = $3
	WHERE isin = $1
	RETURNING asset_type, updated_at`

	AssetUpsertTxAssetSQL = `` /* 255-byte string literal not displayed */

	AssetUpsertTxAssetTypeSQL = `INSERT INTO asset_types
	(name, created_at)
	VALUES ($1, $2)
	ON CONFLICT (name)
	DO NOTHING`
)
View Source
const (
	KeyFormat = "%32s%s"

	FavoritesSelectSQL = `` /* 414-byte string literal not displayed */

	FavoritesSelectForUserSQL = `` /* 505-byte string literal not displayed */

	FavoritesDeleteSQL = `` /* 203-byte string literal not displayed */

	FavoritesInsertSQL = `` /* 175-byte string literal not displayed */

	FavoritesUpdateSQL = `` /* 172-byte string literal not displayed */

	FavoritesDeleteTxSQL = `` /* 166-byte string literal not displayed */

	FavoritesUpsertTxAssetSQL = `` /* 139-byte string literal not displayed */

	FavoritesUpsertTxAssetTypeSQL = `INSERT INTO asset_types
	(name, created_at)
	VALUES ($1, $2)
	ON CONFLICT (name)
	DO NOTHING`

	FavoritesUpsertTxUserSQL = `` /* 127-byte string literal not displayed */

	FavoritesUpsertTxFavoritesSQL = `` /* 417-byte string literal not displayed */

)
View Source
const (
	FavoritesDeletedDeleteForUserSQL = `UPDATE favorites
	SET deleted = true, version = (SELECT u.version FROM users u WHERE u.upk = $2)
	WHERE user_upk = $1`

	FavoritesDeletedSelectForUserSQL = `` /* 442-byte string literal not displayed */

)

Variables

This section is empty.

Functions

func IsAssetNotFound

func IsAssetNotFound(a Asset, err error) bool

func IsFavoritesNotFound

func IsFavoritesNotFound(f Favorites, err error) bool

func IsUserNotFound

func IsUserNotFound(u User, err error) bool

Types

type Asset

type Asset struct {
	TAttributes
	// contains filtered or unexported fields
}

func GetAsset

func GetAsset(ctx context.Context, repo domain.Repo[*Asset], isin string) (Asset, error)

func MakeAsset

func MakeAsset(isin string, at AssetType, a TAttributes) Asset

func (Asset) AssetType

func (a Asset) AssetType() AssetType

func (*Asset) Copy

func (a *Asset) Copy() domain.Entity

Copy shallow copy and return same type

func (Asset) CreatedAt

func (a Asset) CreatedAt() time.Time

func (*Asset) Delete

func (a *Asset) Delete(ctx context.Context, dtf domain.Dft[*Asset], inTransaction func()) (err error)

func (*Asset) DeleteArgs

func (a *Asset) DeleteArgs() []any

func (*Asset) DeleteSQL

func (a *Asset) DeleteSQL() string

func (*Asset) DeleteTxArgs

func (a *Asset) DeleteTxArgs() domain.TxArgs

func (Asset) Deleted

func (a Asset) Deleted() sql.NullBool

func (*Asset) FromJSON

func (a *Asset) FromJSON(data []byte) (err error)

func (*Asset) GetArgs

func (a *Asset) GetArgs() []any

func (*Asset) GetByFilterArgs

func (a *Asset) GetByFilterArgs() []any

func (*Asset) GetByFilterSQL

func (a *Asset) GetByFilterSQL() string

func (*Asset) GetSQL

func (a *Asset) GetSQL() string

func (*Asset) InsertArgs

func (a *Asset) InsertArgs() []any

func (*Asset) InsertSQL

func (a *Asset) InsertSQL() string

func (Asset) Isin

func (a Asset) Isin() string

func (*Asset) Key

func (a *Asset) Key() string

func (*Asset) String

func (a *Asset) String() string

func (*Asset) ToJSON

func (a *Asset) ToJSON() ([]byte, error)

func (*Asset) UpdateArgs

func (a *Asset) UpdateArgs() []any

func (*Asset) UpdateSQL

func (a *Asset) UpdateSQL() string

func (Asset) UpdatedAt

func (a Asset) UpdatedAt() sql.NullTime

func (*Asset) Upsert

func (a *Asset) Upsert(ctx context.Context, dtf domain.Dft[*Asset], inTransaction func()) (err error)

func (*Asset) UpsertTxArgs

func (a *Asset) UpsertTxArgs() domain.TxArgs

type AssetType

type AssetType struct {
	TAttributes
	// contains filtered or unexported fields
}

func GetAssetType

func GetAssetType(ctx context.Context, repo domain.Repo[*AssetType], name string) (AssetType, error)

func MakeAssetType

func MakeAssetType(name string, a TAttributes) AssetType

func (*AssetType) Copy

func (a *AssetType) Copy() domain.Entity

func (AssetType) CreatedAt

func (a AssetType) CreatedAt() time.Time

func (*AssetType) Delete

func (a *AssetType) Delete(ctx context.Context, repo domain.Repo[*AssetType]) (err error)

func (*AssetType) DeleteArgs

func (a *AssetType) DeleteArgs() []any

func (*AssetType) DeleteSQL

func (a *AssetType) DeleteSQL() string

func (AssetType) Deleted

func (a AssetType) Deleted() sql.NullBool

func (*AssetType) FromJSON

func (a *AssetType) FromJSON(data []byte) (err error)

func (*AssetType) GetArgs

func (a *AssetType) GetArgs() []any

func (*AssetType) GetByFilterArgs

func (a *AssetType) GetByFilterArgs() []any

func (*AssetType) GetByFilterSQL

func (a *AssetType) GetByFilterSQL() string

func (*AssetType) GetSQL

func (a *AssetType) GetSQL() string

func (*AssetType) Insert

func (a *AssetType) Insert(ctx context.Context, repo domain.Repo[*AssetType]) (err error)

func (*AssetType) InsertArgs

func (a *AssetType) InsertArgs() []any

func (*AssetType) InsertSQL

func (a *AssetType) InsertSQL() string

func (*AssetType) Key

func (a *AssetType) Key() string

func (AssetType) Name

func (a AssetType) Name() string

func (*AssetType) String

func (a *AssetType) String() string

func (*AssetType) ToJSON

func (a *AssetType) ToJSON() ([]byte, error)

func (*AssetType) Update

func (a *AssetType) Update(ctx context.Context, repo domain.Repo[*AssetType]) (err error)

func (*AssetType) UpdateArgs

func (a *AssetType) UpdateArgs() []any

func (*AssetType) UpdateSQL

func (a *AssetType) UpdateSQL() string

func (AssetType) UpdatedAt

func (a AssetType) UpdatedAt() sql.NullTime

type Favorites

type Favorites struct {
	TAttributes
	// contains filtered or unexported fields
}

func GetFavorites

func GetFavorites(ctx context.Context, repo domain.Repo[*Favorites], isin, upk string) (Favorites, error)

func GetFavoritesForUser

func GetFavoritesForUser(ctx context.Context, repo domain.Repo[*Favorites], upk string) ([]Favorites, error)

func MakeFavorites

func MakeFavorites(id uuid.UUID, asset Asset, user User, version sql.NullInt64, a TAttributes) Favorites

func (Favorites) Asset

func (f Favorites) Asset() Asset

func (*Favorites) Copy

func (f *Favorites) Copy() domain.Entity

func (Favorites) CreatedAt

func (f Favorites) CreatedAt() time.Time

func (*Favorites) Delete

func (f *Favorites) Delete(ctx context.Context, dtf domain.Dft[*Favorites], inTransaction func()) (err error)

func (*Favorites) DeleteArgs

func (f *Favorites) DeleteArgs() []any

func (*Favorites) DeleteSQL

func (f *Favorites) DeleteSQL() string

func (*Favorites) DeleteTxArgs

func (f *Favorites) DeleteTxArgs() domain.TxArgs

func (Favorites) Deleted

func (f Favorites) Deleted() sql.NullBool

func (*Favorites) FromJSON

func (f *Favorites) FromJSON(data []byte) (err error)

func (*Favorites) GetArgs

func (f *Favorites) GetArgs() []any

func (*Favorites) GetByFilterArgs

func (f *Favorites) GetByFilterArgs() []any

func (*Favorites) GetByFilterSQL

func (f *Favorites) GetByFilterSQL() string

func (*Favorites) GetSQL

func (f *Favorites) GetSQL() string

func (Favorites) ID

func (f Favorites) ID() uuid.UUID

func (*Favorites) InsertArgs

func (f *Favorites) InsertArgs() []any

func (*Favorites) InsertSQL

func (f *Favorites) InsertSQL() string

func (*Favorites) Key

func (f *Favorites) Key() string

func (*Favorites) String

func (f *Favorites) String() string

func (Favorites) ToJSON

func (f Favorites) ToJSON() ([]byte, error)

func (*Favorites) Update

func (f *Favorites) Update(ctx context.Context, repo domain.Repo[*Favorites]) (err error)

func (*Favorites) UpdateArgs

func (f *Favorites) UpdateArgs() []any

func (*Favorites) UpdateSQL

func (f *Favorites) UpdateSQL() string

func (Favorites) UpdatedAt

func (f Favorites) UpdatedAt() sql.NullTime

func (*Favorites) Upsert

func (f *Favorites) Upsert(ctx context.Context, dtf domain.Dft[*Favorites], inTransaction func()) (err error)

func (*Favorites) UpsertTxArgs

func (f *Favorites) UpsertTxArgs() domain.TxArgs

func (Favorites) User

func (f Favorites) User() User

func (Favorites) Version

func (f Favorites) Version() sql.NullInt64

type FavoritesDeleted

type FavoritesDeleted struct {
	TAttributes
	// contains filtered or unexported fields
}

func GetFavoritesDeletedForUser

func GetFavoritesDeletedForUser(ctx context.Context, repo domain.Repo[*FavoritesDeleted], upk string) ([]FavoritesDeleted, error)

func MakeFavoritesDeletedUser

func MakeFavoritesDeletedUser(upk string) FavoritesDeleted

func (*FavoritesDeleted) Copy

func (f *FavoritesDeleted) Copy() domain.Entity

func (*FavoritesDeleted) Delete

func (f *FavoritesDeleted) Delete(ctx context.Context, repo domain.Repo[*FavoritesDeleted]) (err error)

func (*FavoritesDeleted) DeleteArgs

func (f *FavoritesDeleted) DeleteArgs() []any

func (*FavoritesDeleted) DeleteSQL

func (f *FavoritesDeleted) DeleteSQL() string

func (*FavoritesDeleted) FromJSON

func (f *FavoritesDeleted) FromJSON(data []byte) (err error)

func (*FavoritesDeleted) GetArgs

func (f *FavoritesDeleted) GetArgs() []any

func (*FavoritesDeleted) GetByFilterArgs

func (f *FavoritesDeleted) GetByFilterArgs() []any

func (*FavoritesDeleted) GetByFilterSQL

func (f *FavoritesDeleted) GetByFilterSQL() string

func (*FavoritesDeleted) GetSQL

func (f *FavoritesDeleted) GetSQL() string

func (*FavoritesDeleted) InsertArgs

func (f *FavoritesDeleted) InsertArgs() []any

func (*FavoritesDeleted) InsertSQL

func (f *FavoritesDeleted) InsertSQL() string

func (*FavoritesDeleted) Key

func (f *FavoritesDeleted) Key() string

func (*FavoritesDeleted) String

func (f *FavoritesDeleted) String() string

func (FavoritesDeleted) ToFavorites

func (f FavoritesDeleted) ToFavorites() *Favorites

func (*FavoritesDeleted) ToJSON

func (f *FavoritesDeleted) ToJSON() ([]byte, error)

func (*FavoritesDeleted) Update

func (f *FavoritesDeleted) Update(ctx context.Context, repo domain.Repo[*FavoritesDeleted]) (err error)

func (*FavoritesDeleted) UpdateArgs

func (f *FavoritesDeleted) UpdateArgs() []any

func (*FavoritesDeleted) UpdateSQL

func (f *FavoritesDeleted) UpdateSQL() string

type JsonNullBool

type JsonNullBool struct {
	sql.NullBool
}

func FromNullBool

func FromNullBool(b sql.NullBool) JsonNullBool

func (JsonNullBool) MarshalJSON

func (v JsonNullBool) MarshalJSON() ([]byte, error)

func (JsonNullBool) ToNullBool

func (v JsonNullBool) ToNullBool() sql.NullBool

func (*JsonNullBool) UnmarshalJSON

func (v *JsonNullBool) UnmarshalJSON(data []byte) error

type JsonNullTime

type JsonNullTime struct {
	sql.NullTime
}

func FromNullTime

func FromNullTime(b sql.NullTime) JsonNullTime

func (JsonNullTime) MarshalJSON

func (v JsonNullTime) MarshalJSON() ([]byte, error)

func (JsonNullTime) ToNullTime

func (v JsonNullTime) ToNullTime() sql.NullTime

func (*JsonNullTime) UnmarshalJSON

func (v *JsonNullTime) UnmarshalJSON(data []byte) error

type TAttributes

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

func DefaultTAttributes

func DefaultTAttributes() TAttributes

func MakeTAttributes

func MakeTAttributes(deleted sql.NullBool, createdAt time.Time, updatedAt sql.NullTime) TAttributes

type User

type User struct {
	TAttributes
	// contains filtered or unexported fields
}

func GetUser

func GetUser(ctx context.Context, repo domain.Repo[*User], upk string) (User, error)

func MakeUser

func MakeUser(upk string, a TAttributes) User

func MakeUserWithVersion

func MakeUserWithVersion(upk string, version int64, a TAttributes) User

func (*User) Copy

func (u *User) Copy() domain.Entity

func (User) CreatedAt

func (u User) CreatedAt() time.Time

func (*User) Delete

func (u *User) Delete(ctx context.Context, repo domain.Repo[*User]) (err error)

func (*User) DeleteArgs

func (u *User) DeleteArgs() []any

func (*User) DeleteSQL

func (u *User) DeleteSQL() string

func (User) Deleted

func (u User) Deleted() sql.NullBool

func (*User) FromJSON

func (u *User) FromJSON(data []byte) (err error)

func (*User) GetArgs

func (u *User) GetArgs() []any

func (*User) GetByFilterArgs

func (u *User) GetByFilterArgs() []any

func (*User) GetByFilterSQL

func (u *User) GetByFilterSQL() string

func (*User) GetSQL

func (u *User) GetSQL() string

func (*User) Insert

func (u *User) Insert(ctx context.Context, repo domain.Repo[*User]) (err error)

func (*User) InsertArgs

func (u *User) InsertArgs() []any

func (*User) InsertSQL

func (u *User) InsertSQL() string

func (*User) Key

func (u *User) Key() string

func (*User) String

func (u *User) String() string

func (*User) ToJSON

func (u *User) ToJSON() ([]byte, error)

func (*User) Update

func (u *User) Update(ctx context.Context, repo domain.Repo[*User]) (err error)

func (*User) UpdateArgs

func (u *User) UpdateArgs() []any

func (*User) UpdateSQL

func (u *User) UpdateSQL() string

func (User) UpdatedAt

func (u User) UpdatedAt() sql.NullTime

func (User) Upk

func (u User) Upk() string

func (User) Version

func (u User) Version() int64

Jump to

Keyboard shortcuts

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