repository

package
v0.0.0-...-5d22bd2 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package repository contains all database logic for storage

Index

Constants

View Source
const PublicDir = "/api/v1/files/"

Variables

View Source
var ErrDBNotInitialized = fmt.Errorf("db not initialised")

ErrDBNotInitialized - default database connection error.

Functions

func NewError

func NewError(err error) error

func SetPassword

func SetPassword(password interface{}) (string, error)

Types

type AggregatedCategoryCollectionsCollectiblesJSON

type AggregatedCategoryCollectionsCollectiblesJSON []CategoryCollectionCollectible

func (*AggregatedCategoryCollectionsCollectiblesJSON) Scan

func (a *AggregatedCategoryCollectionsCollectiblesJSON) Scan(val interface{}) error

func (*AggregatedCategoryCollectionsCollectiblesJSON) Value

type AggregatedCategoryCollectionsJSON

type AggregatedCategoryCollectionsJSON []CategoryCollection

func (*AggregatedCategoryCollectionsJSON) Scan

func (a *AggregatedCategoryCollectionsJSON) Scan(val interface{}) error

func (*AggregatedCategoryCollectionsJSON) Value

type AggregatedImageJSON

type AggregatedImageJSON models.PublicFile

func (*AggregatedImageJSON) Scan

func (a *AggregatedImageJSON) Scan(val interface{}) error

func (*AggregatedImageJSON) Value

func (a *AggregatedImageJSON) Value() (driver.Value, error)

type AggregatedMenuAttributesJSON

type AggregatedMenuAttributesJSON models.PublicMenuAttributes

func (*AggregatedMenuAttributesJSON) Scan

func (a *AggregatedMenuAttributesJSON) Scan(val interface{}) error

func (*AggregatedMenuAttributesJSON) Value

type AggregatedSliderItemJSON

type AggregatedSliderItemJSON []*models.PublicSliderItem

func (*AggregatedSliderItemJSON) Scan

func (a *AggregatedSliderItemJSON) Scan(val interface{}) error

func (*AggregatedSliderItemJSON) Value

type CategoriesRepository

type CategoriesRepository struct {
	DB  sqlx.DB
	TBL string
}

CategoriesRepository - repository to store frontend categories.

func NewCategoriesRepository

func NewCategoriesRepository(db *sqlx.DB, tbl string) *CategoriesRepository

func (*CategoriesRepository) GetPublicCollectibleCategories

func (r *CategoriesRepository) GetPublicCollectibleCategories(ctx context.Context, users UsersRepositoryInterface) ([]*models.PublicCategory, error)

func (*CategoriesRepository) InnerDB

func (r *CategoriesRepository) InnerDB() *sqlx.DB

func (*CategoriesRepository) Ping

func (r *CategoriesRepository) Ping() error

type CategoriesRepositoryInterface

type CategoriesRepositoryInterface interface {
	InnerDB() *sqlx.DB
	Ping() error
	GetPublicCollectibleCategories(ctx context.Context, users UsersRepositoryInterface) ([]*models.PublicCategory, error)
}

type Category

type Category struct {
	Deleted     time.Time                         `db:"deleted"`
	Updated     time.Time                         `db:"updated"`
	Created     time.Time                         `db:"created"`
	CreatedByID *int64                            `db:"created_by_id"`
	ParentID    *int64                            `db:"parent_id"`
	Description *string                           `db:"description"`
	Content     *string                           `db:"content"`
	ImageID     *int64                            `db:"image_id"`
	UpdatedByID *int64                            `db:"updated_by_id"`
	OrderBy     *int64                            `db:"order_by"`
	Slug        string                            `db:"slug"`
	Title       string                            `db:"title"`
	Provider    string                            `db:"provider"`
	Collections AggregatedCategoryCollectionsJSON `db:"collections"`
	ID          int64                             `db:"id"`
	Enabled     bool                              `db:"enabled"`
}

type CategoryCollection

type CategoryCollection struct {
	Attributes CategoryCollectionAttributes
	ID         int64 `db:"id"`
}

type CategoryCollectionAttributes

type CategoryCollectionAttributes struct {
	Deleted      time.Time                                     `db:"deleted_at"`
	Updated      time.Time                                     `db:"updated_at"`
	Description  string                                        `db:"description"`
	Fee          string                                        `db:"fee"`
	Symbol       string                                        `db:"symbol"`
	Name         string                                        `db:"name"`
	Created      string                                        `db:"created"`
	Address      string                                        `db:"address"`
	Slug         string                                        `db:"slug"`
	URL          string                                        `db:"url"`
	Featured     AggregatedImageJSON                           `db:"featured"`
	Banner       AggregatedImageJSON                           `db:"banner"`
	Collectibles AggregatedCategoryCollectionsCollectiblesJSON `db:"collectibles"`
	Creator      int64                                         `db:"creator"`
	Owner        int64                                         `db:"owner"`
	MaxItems     int64                                         `db:"max_items"`
	CategoryID   int64                                         `db:"category_id"`
	// contains filtered or unexported fields
}

type CategoryCollectionCollectible

type CategoryCollectionCollectible struct {
	Attributes CategoryCollectionCollectibleAttributes
	ID         int64 `db:"id"`
}

type CategoryCollectionCollectibleAttributes

type CategoryCollectionCollectibleAttributes struct {
	Created    time.Time           `db:"created"`
	Metadata   CollectibleMetadata `db:"metadata"`
	URI        string              `db:"uri"`
	Tokens     []int64             `db:"tokens"`
	Details    CollectibleDetails  `db:"details"`
	Item       int64               `db:"item"`
	Collection int64               `db:"collection"`
	Creator    int64               `db:"creator"`
	Owner      int64               `db:"owner"`
}

type Collectible

type Collectible struct {
	Created      time.Time           `db:"created"`
	Updated      time.Time           `db:"updated"`
	Deleted      time.Time           `db:"deleted"`
	Metadata     CollectibleMetadata `db:"metadata"`
	Creator      string              `db:"creator"`
	Owner        string              `db:"owner"`
	URI          string              `db:"uri"`
	TokenIDs     []int64             `db:"token_ids"`
	Details      CollectibleDetails  `db:"details"`
	ID           int64               `db:"id"`
	CollectionID int64               `db:"collection_id"`
}

type CollectibleDetails

type CollectibleDetails struct {
	StartPrice      string `json:"start_price"`
	Tags            string `json:"tags"`
	Collection      string `json:"collection"`
	TotalWei        string `json:"total_wei"`
	ReservePriceWei string `json:"reserve_price_wei"`
	Total           string `json:"total"`
	PriceWei        string `json:"price_wei"`
	FeeWei          string `json:"fee_wei"`
	ReservePrice    string `json:"reserve_price"`
	StartPriceWei   string `json:"start_price_wei"`
	Price           string `json:"price"`
	Fee             string `json:"fee"`
	Address         string `json:"address"`
	StartTime       int64  `json:"start_time"`
	EndTime         int64  `json:"end_time"`
	Quantity        int64  `json:"quantity"`
	IsStarted       bool   `json:"is_started"`
	Cancelled       bool   `json:"cancelled"`
	Fulfilled       bool   `json:"fulfilled"`
	Auction         bool   `json:"auction"`
}

type CollectibleMetadata

type CollectibleMetadata struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Image       string `json:"image"`
	ExternalURL string `json:"external_url"`
}

type Contract

type Contract struct {
	Created strfmt.Date `db:"created"`
	Updated strfmt.Date `db:"updated"`
	Deleted strfmt.Date `db:"deleted"`
	Name    string      `db:"name"`
	Address string      `db:"address"`
	Tx      string      `db:"tx"`
	ABI     string      `db:"abi"`
	ID      int64       `db:"id"`
}

type ContractsRepository

type ContractsRepository struct {
	DB  sqlx.DB
	TBL string
}

UsersRepository - repository to store users.

func NewContractsRepository

func NewContractsRepository(db *sqlx.DB, tbl string) *ContractsRepository

func (*ContractsRepository) Create

func (r *ContractsRepository) Create(ctx context.Context, contractMap map[string]interface{}) error

func (*ContractsRepository) GetAuctions

func (r *ContractsRepository) GetAuctions(ctx context.Context) ([]*models.Contract, error)

func (*ContractsRepository) GetByAddress

func (r *ContractsRepository) GetByAddress(ctx context.Context, address common.Address) (*models.Contract, error)

func (*ContractsRepository) GetCollectionsContracts

func (r *ContractsRepository) GetCollectionsContracts(ctx context.Context) ([]*models.Contract, error)

func (*ContractsRepository) GetContractsByType

func (r *ContractsRepository) GetContractsByType(ctx context.Context, contractType string) ([]*models.Contract, error)

func (*ContractsRepository) GetOne

func (r *ContractsRepository) GetOne(ctx context.Context, name string) (*models.Contract, error)

func (*ContractsRepository) InnerDB

func (r *ContractsRepository) InnerDB() *sqlx.DB

func (*ContractsRepository) Ping

func (r *ContractsRepository) Ping() error

type ContractsRepositoryInterface

type ContractsRepositoryInterface interface {
	InnerDB() *sqlx.DB
	Ping() error
	Create(ctx context.Context, contractMap map[string]interface{}) error
	GetOne(ctx context.Context, name string) (*models.Contract, error)
	GetByAddress(ctx context.Context, address common.Address) (*models.Contract, error)
	GetCollectionsContracts(ctx context.Context) ([]*models.Contract, error)
	GetAuctions(ctx context.Context) ([]*models.Contract, error)
}

type Error

type Error struct {
	Err error
}

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

type File

type File struct {
	Updated     strfmt.Date `db:"updated"`
	Created     strfmt.Date `db:"created"`
	Deleted     strfmt.Date `db:"deleted"`
	Metadata    interface{} `db:"metadata"`
	Formats     interface{} `db:"formats"`
	Provider    *string     `db:"provider"`
	Thumb       string      `db:"preview_url"`
	Hash        string      `db:"hash"`
	Ext         string      `db:"ext"`
	Caption     string      `db:"caption"`
	URL         string      `db:"url"`
	Alt         string      `db:"alt"`
	Name        string      `db:"name"`
	Mime        string      `db:"mime"`
	Height      int64       `db:"height"`
	CreatedByID int64       `db:"created_by_id"`
	UpdatedByID int64       `db:"updated_by_id"`
	Size        float64     `db:"size"`
	ID          int64       `db:"id"`
	Width       int64       `db:"width"`
}

type FilesRepository

type FilesRepository struct {
	DB  sqlx.DB
	TBL string
}

FilesRepository - repository to store files.

func NewFilesRepository

func NewFilesRepository(db *sqlx.DB, tbl string) *FilesRepository

func (*FilesRepository) Create

func (r *FilesRepository) Create(ctx context.Context, fileMap map[string]interface{}) error

func (*FilesRepository) GetFileByID

func (r *FilesRepository) GetFileByID(ctx context.Context, id int64) (*models.File, error)

func (*FilesRepository) GetFileByName

func (r *FilesRepository) GetFileByName(ctx context.Context, name string) (*models.File, error)

func (*FilesRepository) GetFiles

func (r *FilesRepository) GetFiles(ctx context.Context) ([]*models.File, error)

func (*FilesRepository) GetPublicFileByID

func (r *FilesRepository) GetPublicFileByID(ctx context.Context, id int64) (*models.PublicFile, error)

func (*FilesRepository) GetPublicFileByName

func (r *FilesRepository) GetPublicFileByName(ctx context.Context, name string) (*models.PublicFile, error)

func (*FilesRepository) GetPublicFilesByProvider

func (r *FilesRepository) GetPublicFilesByProvider(ctx context.Context, provider string) ([]*models.PublicFile, error)

func (*FilesRepository) InnerDB

func (r *FilesRepository) InnerDB() *sqlx.DB

func (*FilesRepository) Ping

func (r *FilesRepository) Ping() error

func (*FilesRepository) Update

func (r *FilesRepository) Update(ctx context.Context, fileMap map[string]interface{}) ([]*models.File, error)

type FilesRepositoryInterface

type FilesRepositoryInterface interface {
	InnerDB() *sqlx.DB
	Ping() error

	Create(ctx context.Context, fileMap map[string]interface{}) error
	Update(ctx context.Context, fileMap map[string]interface{}) ([]*models.File, error)
	GetFiles(ctx context.Context) ([]*models.File, error)
	GetFileByName(ctx context.Context, name string) (*models.File, error)
	GetFileByID(ctx context.Context, id int64) (*models.File, error)
	GetPublicFilesByProvider(ctx context.Context, provider string) ([]*models.PublicFile, error)
	GetPublicFileByName(ctx context.Context, name string) (*models.PublicFile, error)
	GetPublicFileByID(ctx context.Context, id int64) (*models.PublicFile, error)
}
type Menu struct {
	Created   strfmt.Date `db:"created"`
	Updated   strfmt.Date `db:"updated"`
	Deleted   strfmt.Date `db:"deleted"`
	Title     string      `db:"title"`
	ID        int64       `db:"id"`
	CreatedBy int64       `db:"created_by"`
	UpdatedBy int64       `db:"updated_by"`
	Enabled   bool        `db:"enabled"`
}
type MenuSection struct {
	Created   strfmt.Date `db:"created"`
	Updated   strfmt.Date `db:"updated"`
	Deleted   strfmt.Date `db:"deleted"`
	Title     string      `db:"title"`
	ID        int64       `db:"id"`
	MenuID    int64       `db:"menu_id"`
	OrderBy   int64       `db:"order_by"`
	CreatedBy int64       `db:"created_by"`
	UpdatedBy int64       `db:"updated_by"`
	Enabled   bool        `db:"enabled"`
}
type MenusRepository struct {
	DB  sqlx.DB
	TBL string
}

MenusRepository - repository to store frontend menus.

func NewMenusRepository

func NewMenusRepository(db *sqlx.DB, tbl string) *MenusRepository
func (r *MenusRepository) GetMenuByProvider(ctx context.Context, provider string) (*models.PublicMenu, error)
func (r *MenusRepository) InnerDB() *sqlx.DB
func (r *MenusRepository) Ping() error
type MenusRepositoryInterface interface {
	InnerDB() *sqlx.DB
	Ping() error

	GetMenuByProvider(ctx context.Context, provider string) (*models.PublicMenu, error)
}

type Page

type Page struct {
	Created     strfmt.Date `db:"created"`
	Deleted     strfmt.Date `db:"deleted"`
	Updated     strfmt.Date `db:"updated"`
	Title       string      `db:"title"`
	Slug        string      `db:"slug"`
	Description string      `db:"description"`
	Content     string      `db:"content"`
	ImageID     int64       `db:"image_id"`
	OrderBy     int64       `db:"order_by"`
	CreatedBy   int64       `db:"created_by"`
	UpdatedBy   int64       `db:"updated_by"`
	ID          int64       `db:"id"`
	CategoryID  int64       `db:"category_id"`
	Enabled     bool        `db:"enabled"`
}

type PagesRepository

type PagesRepository struct {
	DB  sqlx.DB
	TBL string
}

PagesRepository - repository to store frontend pages.

func NewPagesRepository

func NewPagesRepository(db *sqlx.DB, tbl string) *PagesRepository

func (*PagesRepository) InnerDB

func (r *PagesRepository) InnerDB() *sqlx.DB

func (*PagesRepository) Ping

func (r *PagesRepository) Ping() error

type PagesRepositoryInterface

type PagesRepositoryInterface interface {
	InnerDB() *sqlx.DB
	Ping() error
}

type Slider

type Slider struct {
	Created     strfmt.Date `db:"created"`
	Updated     strfmt.Date `db:"updated"`
	Deleted     strfmt.Date `db:"deleted"`
	Provider    string      `db:"provider"`
	Title       string      `db:"title"`
	Description string      `db:"description"`
	ID          int64       `db:"id"`
	CreatedBy   int64       `db:"created_by"`
	UpdatedBy   int64       `db:"updated_by"`
	Enabled     bool        `db:"enabled"`
}

type SlidersRepository

type SlidersRepository struct {
	DB  sqlx.DB
	TBL string
}

SlidersRepository - repository to store frontend sliders.

func NewSlidersRepository

func NewSlidersRepository(db *sqlx.DB, tbl string) *SlidersRepository

func (*SlidersRepository) Create

func (r *SlidersRepository) Create(ctx context.Context, sliderMap map[string]interface{}) error

func (*SlidersRepository) GetSliderByID

func (r *SlidersRepository) GetSliderByID(ctx context.Context, id int64) (*models.Slider, error)

func (*SlidersRepository) GetSliderByProvider

func (r *SlidersRepository) GetSliderByProvider(ctx context.Context, provider string) (*models.PublicSlider, error)

func (*SlidersRepository) GetSliderByTitle

func (r *SlidersRepository) GetSliderByTitle(ctx context.Context, title string) (*models.Slider, error)

func (*SlidersRepository) GetSliders

func (r *SlidersRepository) GetSliders(ctx context.Context) ([]*models.Slider, error)

func (*SlidersRepository) InnerDB

func (r *SlidersRepository) InnerDB() *sqlx.DB

func (*SlidersRepository) Ping

func (r *SlidersRepository) Ping() error

func (*SlidersRepository) Update

func (r *SlidersRepository) Update(ctx context.Context, sliderMap map[string]interface{}) ([]*models.Slider, error)

type SlidersRepositoryInterface

type SlidersRepositoryInterface interface {
	InnerDB() *sqlx.DB
	Ping() error
	Create(ctx context.Context, sliderMap map[string]interface{}) error
	Update(ctx context.Context, sliderMap map[string]interface{}) ([]*models.Slider, error)
	GetSliders(ctx context.Context) ([]*models.Slider, error)
	GetSliderByTitle(ctx context.Context, title string) (*models.Slider, error)
	GetSliderByID(ctx context.Context, id int64) (*models.Slider, error)
	GetSliderByProvider(ctx context.Context, provider string) (*models.PublicSlider, error)
}

type User

type User struct {
	Created              strfmt.Date `db:"created"`
	Updated              strfmt.Date `db:"updated"`
	Deleted              strfmt.Date `db:"deleted"`
	PasswordResetToken   *string     `db:"password_reset_token"`
	PasswordResetExpires *int64      `db:"password_reset_expires"`
	RSASecret            string      `db:"rsa_secret"`
	Email                string      `db:"email"`
	Password             string      `db:"password"`
	Secret               string      `db:"secret"`
	UUID                 string      `db:"uuid"`
	Username             string      `db:"username"`
	Address              string      `db:"address"`
	Nonce                string      `db:"nonce"`
	ID                   int64       `db:"id"`
	Enabled              bool        `db:"enabled"`
}

type UsersRepository

type UsersRepository struct {
	DB  sqlx.DB
	TBL string
}

UsersRepository - repository to store users.

func NewUsersRepository

func NewUsersRepository(db *sqlx.DB, tbl string) *UsersRepository

func (*UsersRepository) Create

func (r *UsersRepository) Create(ctx context.Context, userMap map[string]interface{}) error

func (*UsersRepository) GetOne

func (r *UsersRepository) GetOne(ctx context.Context, email string) (*User, error)

func (*UsersRepository) GetPublicUserByID

func (r *UsersRepository) GetPublicUserByID(ctx context.Context, id int64) (*models.PublicUser, error)

func (*UsersRepository) GetUserByAddress

func (r *UsersRepository) GetUserByAddress(ctx context.Context, address string) (*User, error)

func (*UsersRepository) InnerDB

func (r *UsersRepository) InnerDB() *sqlx.DB

func (*UsersRepository) Ping

func (r *UsersRepository) Ping() error

type UsersRepositoryInterface

type UsersRepositoryInterface interface {
	InnerDB() *sqlx.DB
	Ping() error
	Create(ctx context.Context, userMap map[string]interface{}) error
	GetOne(ctx context.Context, email string) (*User, error)
	GetPublicUserByID(ctx context.Context, id int64) (*models.PublicUser, error)
	GetUserByAddress(ctx context.Context, address string) (*User, error)
}

UsersRepositoryInterface - interface to store users.

Jump to

Keyboard shortcuts

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