repository

package
v0.0.0-...-54b74c5 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const FALSE = "false"
View Source
const INDEX_FIELD = "Index"
View Source
const RAW_NOTICE_TYPE = "notice"
View Source
const RAW_VOUCHER_TYPE = "voucher"
View Source
const WHERE = "WHERE "

Variables

This section is empty.

Functions

func GenerateBatchInputKey

func GenerateBatchInputKey(appContract string, inputIndex uint64) string

func GenerateBatchNoticeKey

func GenerateBatchNoticeKey(appContract string, inputIndex uint64) string

func GenerateBatchReportKey

func GenerateBatchReportKey(appContract *common.Address, inputIndex int) string

func GenerateBatchVoucherKey

func GenerateBatchVoucherKey(appContract *common.Address, inputIndex int) string

func GetTransaction

func GetTransaction(ctx context.Context) (*sqlx.Tx, bool)

func StartTransaction

func StartTransaction(ctx context.Context, db *sqlx.DB) (context.Context, error)

func StartTransactionContext

func StartTransactionContext(ctx context.Context, db *sqlx.DB) (context.Context, *sqlx.Tx, error)

Types

type BatchFilterItem

type BatchFilterItem struct {
	AppContract *common.Address
	InputIndex  int
}

type BatchFilterItemForNotice

type BatchFilterItemForNotice struct {
	AppContract string
	InputIndex  int
}

type DBExecutor

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

func (*DBExecutor) ExecContext

func (c *DBExecutor) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)

type InputRepository

type InputRepository struct {
	Db sqlx.DB
}

func (*InputRepository) BatchFindInputByInputIndexAndAppContract

func (c *InputRepository) BatchFindInputByInputIndexAndAppContract(
	ctx context.Context,
	filters []*BatchFilterItem,
) ([]*model.AdvanceInput, []error)

func (*InputRepository) Count

func (c *InputRepository) Count(
	ctx context.Context,
	filter []*model.ConvenienceFilter,
) (uint64, error)

func (*InputRepository) Create

func (*InputRepository) CreateTables

func (r *InputRepository) CreateTables() error

func (*InputRepository) FindAll

func (c *InputRepository) FindAll(
	ctx context.Context,
	first *int,
	last *int,
	after *string,
	before *string,
	filter []*model.ConvenienceFilter,
) (*commons.PageResult[model.AdvanceInput], error)

func (*InputRepository) FindByIDAndAppContract

func (r *InputRepository) FindByIDAndAppContract(ctx context.Context, id string, appContract *common.Address) (*model.AdvanceInput, error)

func (*InputRepository) FindByIndexAndAppContract

func (r *InputRepository) FindByIndexAndAppContract(ctx context.Context,
	inputIndex int,
	appContract *common.Address,
) (*model.AdvanceInput, error)

func (*InputRepository) FindByStatus

func (r *InputRepository) FindByStatus(ctx context.Context, status model.CompletionStatus) (*model.AdvanceInput, error)

func (*InputRepository) FindByStatusNeDesc

func (r *InputRepository) FindByStatusNeDesc(ctx context.Context, status model.CompletionStatus) (*model.AdvanceInput, error)

func (*InputRepository) GetNonce

func (c *InputRepository) GetNonce(
	ctx context.Context,
	appContract common.Address,
	msgSender common.Address,
) (uint64, error)

func (*InputRepository) RawCreate

func (*InputRepository) Update

func (*InputRepository) UpdateStatus

func (r *InputRepository) UpdateStatus(ctx context.Context, appContract common.Address, inputIndex uint64, status model.CompletionStatus) error

type NoticeRepository

type NoticeRepository struct {
	Db               sqlx.DB
	OutputRepository OutputRepository
	AutoCount        bool
}

func (*NoticeRepository) BatchFindAllNoticesByInputIndexAndAppContract

func (c *NoticeRepository) BatchFindAllNoticesByInputIndexAndAppContract(
	ctx context.Context,
	filters []*BatchFilterItemForNotice,
) ([]*commons.PageResult[model.ConvenienceNotice], []error)

func (*NoticeRepository) Count

func (c *NoticeRepository) Count(
	ctx context.Context,
	filter []*model.ConvenienceFilter,
) (uint64, error)

func (*NoticeRepository) Create

func (*NoticeRepository) CreateTables

func (c *NoticeRepository) CreateTables() error

func (*NoticeRepository) FindAllNotices

func (c *NoticeRepository) FindAllNotices(
	ctx context.Context,
	first *int,
	last *int,
	after *string,
	before *string,
	filter []*model.ConvenienceFilter,
) (*commons.PageResult[model.ConvenienceNotice], error)

func (*NoticeRepository) FindAllNoticesByBlockNumber

func (c *NoticeRepository) FindAllNoticesByBlockNumber(
	ctx context.Context, startBlockGte uint64, endBlockLt uint64,
) ([]*model.ConvenienceNotice, error)

func (*NoticeRepository) FindByInputAndOutputIndex

func (c *NoticeRepository) FindByInputAndOutputIndex(
	ctx context.Context, inputIndex uint64, outputIndex uint64,
) (*model.ConvenienceNotice, error)

func (*NoticeRepository) FindNoticeByOutputIndexAndAppContract

func (c *NoticeRepository) FindNoticeByOutputIndexAndAppContract(
	ctx context.Context, outputIndex uint64,
	appContract *common.Address,
) (*model.ConvenienceNotice, error)

func (*NoticeRepository) SetProof

func (c *NoticeRepository) SetProof(
	ctx context.Context, notice *model.ConvenienceNotice,
) error

func (*NoticeRepository) Update

type OutputRepository

type OutputRepository struct {
	Db sqlx.DB
}

func (*OutputRepository) CountAllNotices

func (c *OutputRepository) CountAllNotices(
	ctx context.Context,
) (uint64, error)

func (*OutputRepository) CountAllOutputs

func (c *OutputRepository) CountAllOutputs(
	ctx context.Context,
) (uint64, error)

func (*OutputRepository) CountAllVouchers

func (c *OutputRepository) CountAllVouchers(
	ctx context.Context,
) (uint64, error)

func (*OutputRepository) CountNoticeProofs

func (c *OutputRepository) CountNoticeProofs(ctx context.Context) (uint64, error)

func (*OutputRepository) CountProofs

func (c *OutputRepository) CountProofs(ctx context.Context) (uint64, error)

func (*OutputRepository) CountVoucherProofs

func (c *OutputRepository) CountVoucherProofs(ctx context.Context) (uint64, error)

type RawInputRef

type RawInputRef struct {
	ID          string `db:"id"`     // High level ID refers to our ConvenienceInput.ID
	RawID       uint64 `db:"raw_id"` // Low level ID
	InputIndex  uint64 `db:"input_index"`
	AppContract string `db:"app_contract"`
	Status      string `db:"status"`
	ChainID     string `db:"chain_id"`
}

type RawInputRefRepository

type RawInputRefRepository struct {
	Db sqlx.DB
}

func (*RawInputRefRepository) Create

func (r *RawInputRefRepository) Create(ctx context.Context, rawInput RawInputRef) error

func (*RawInputRefRepository) CreateTables

func (r *RawInputRefRepository) CreateTables() error

func (*RawInputRefRepository) FindByRawIdAndAppContract

func (r *RawInputRefRepository) FindByRawIdAndAppContract(ctx context.Context, rawId uint64, appContract *common.Address) (*RawInputRef, error)

func (*RawInputRefRepository) FindFirstInputByStatusNone

func (r *RawInputRefRepository) FindFirstInputByStatusNone(ctx context.Context, limit int) (*RawInputRef, error)

func (*RawInputRefRepository) GetLatestRawId

func (r *RawInputRefRepository) GetLatestRawId(ctx context.Context) (uint64, error)

func (*RawInputRefRepository) UpdateStatus

func (r *RawInputRefRepository) UpdateStatus(ctx context.Context, rawInputsIds []string, status string) error

type RawOutputRef

type RawOutputRef struct {
	RawID       uint64    `db:"raw_id"`
	OutputIndex uint64    `db:"output_index"`
	InputIndex  uint64    `db:"input_index"`
	AppContract string    `db:"app_contract"`
	Type        string    `db:"type"`
	HasProof    bool      `db:"has_proof"`
	Executed    bool      `db:"executed"`
	UpdatedAt   time.Time `db:"updated_at"`
}

type RawOutputRefRepository

type RawOutputRefRepository struct {
	Db *sqlx.DB
}

func (*RawOutputRefRepository) Create

func (r *RawOutputRefRepository) Create(ctx context.Context, rawOutput RawOutputRef) error

func (*RawOutputRefRepository) CreateTable

func (r *RawOutputRefRepository) CreateTable() error

func (*RawOutputRefRepository) FindByID

func (*RawOutputRefRepository) GetFirstOutputIdWithoutProof

func (r *RawOutputRefRepository) GetFirstOutputIdWithoutProof(ctx context.Context) (uint64, error)

func (*RawOutputRefRepository) GetLastUpdatedAtExecuted

func (r *RawOutputRefRepository) GetLastUpdatedAtExecuted(ctx context.Context) (*time.Time, *uint64, error)

func (*RawOutputRefRepository) GetLatestOutputRawId

func (r *RawOutputRefRepository) GetLatestOutputRawId(ctx context.Context) (uint64, error)

func (*RawOutputRefRepository) SetExecutedToTrue

func (r *RawOutputRefRepository) SetExecutedToTrue(ctx context.Context, rawOutputRef *RawOutputRef) error

func (*RawOutputRefRepository) SetHasProofToTrue

func (r *RawOutputRefRepository) SetHasProofToTrue(ctx context.Context, rawOutputRef *RawOutputRef) error

type ReportRepository

type ReportRepository struct {
	Db        *sqlx.DB
	AutoCount bool
}

func (*ReportRepository) BatchFindAllByInputIndexAndAppContract

func (c *ReportRepository) BatchFindAllByInputIndexAndAppContract(
	ctx context.Context,
	filters []*BatchFilterItem,
) ([]*commons.PageResult[cModel.Report], []error)

func (*ReportRepository) Count

func (c *ReportRepository) Count(
	ctx context.Context,
	filter []*cModel.ConvenienceFilter,
) (uint64, error)

func (*ReportRepository) CreateReport

func (r *ReportRepository) CreateReport(ctx context.Context, report cModel.Report) (cModel.Report, error)

func (*ReportRepository) CreateTables

func (r *ReportRepository) CreateTables() error

func (*ReportRepository) FindAll

func (c *ReportRepository) FindAll(
	ctx context.Context,
	first *int,
	last *int,
	after *string,
	before *string,
	filter []*cModel.ConvenienceFilter,
) (*commons.PageResult[cModel.Report], error)

func (*ReportRepository) FindAllByInputIndex

func (c *ReportRepository) FindAllByInputIndex(
	ctx context.Context,
	first *int,
	last *int,
	after *string,
	before *string,
	inputIndex *int,
) (*commons.PageResult[cModel.Report], error)

func (*ReportRepository) FindByInputAndOutputIndex

func (r *ReportRepository) FindByInputAndOutputIndex(
	ctx context.Context,
	inputIndex uint64,
	outputIndex uint64,
) (*cModel.Report, error)

func (*ReportRepository) FindByOutputIndexAndAppContract

func (r *ReportRepository) FindByOutputIndexAndAppContract(
	ctx context.Context,
	outputIndex uint64,
	appContract *common.Address,
) (*cModel.Report, error)

func (*ReportRepository) FindLastRawId

func (r *ReportRepository) FindLastRawId(ctx context.Context) (uint64, error)

func (*ReportRepository) FindReportByAppContractAndIndex

func (r *ReportRepository) FindReportByAppContractAndIndex(ctx context.Context, index int, appContract common.Address) (*cModel.Report, error)

func (*ReportRepository) Update

func (r *ReportRepository) Update(ctx context.Context, report cModel.Report) (*cModel.Report, error)

type SynchronizerRepository

type SynchronizerRepository struct {
	Db sqlx.DB
}

func (*SynchronizerRepository) Count

func (c *SynchronizerRepository) Count(
	ctx context.Context,
) (uint64, error)

func (*SynchronizerRepository) Create

func (*SynchronizerRepository) CreateTables

func (c *SynchronizerRepository) CreateTables() error

func (*SynchronizerRepository) GetDB

func (c *SynchronizerRepository) GetDB() *sqlx.DB

func (*SynchronizerRepository) GetLastFetched

func (c *SynchronizerRepository) GetLastFetched(
	ctx context.Context,
) (*model.SynchronizerFetch, error)

func (*SynchronizerRepository) PurgeData

func (c *SynchronizerRepository) PurgeData(
	ctx context.Context, timestampBefore uint64,
) error

type VoucherRepository

type VoucherRepository struct {
	Db               sqlx.DB
	OutputRepository OutputRepository
	AutoCount        bool
}

func (*VoucherRepository) BatchFindAllByInputIndexAndAppContract

func (c *VoucherRepository) BatchFindAllByInputIndexAndAppContract(
	ctx context.Context,
	filters []*BatchFilterItem,
) ([]*commons.PageResult[model.ConvenienceVoucher], []error)

func (*VoucherRepository) Count

func (c *VoucherRepository) Count(
	ctx context.Context,
	filter []*model.ConvenienceFilter,
) (uint64, error)

func (*VoucherRepository) CreateTables

func (c *VoucherRepository) CreateTables() error

func (*VoucherRepository) CreateVoucher

func (c *VoucherRepository) CreateVoucher(
	ctx context.Context, voucher *model.ConvenienceVoucher,
) (*model.ConvenienceVoucher, error)

func (*VoucherRepository) FindAllVouchers

func (c *VoucherRepository) FindAllVouchers(
	ctx context.Context,
	first *int,
	last *int,
	after *string,
	before *string,
	filter []*model.ConvenienceFilter,
) (*commons.PageResult[model.ConvenienceVoucher], error)

func (*VoucherRepository) FindAllVouchersByBlockNumber

func (c *VoucherRepository) FindAllVouchersByBlockNumber(
	ctx context.Context, startBlockGte uint64, endBlockLt uint64,
) ([]*model.ConvenienceVoucher, error)

func (*VoucherRepository) FindVoucherByAppContractAndIndex

func (c *VoucherRepository) FindVoucherByAppContractAndIndex(ctx context.Context, index int, appContract common.Address) (*model.ConvenienceVoucher, error)

func (*VoucherRepository) FindVoucherByInputAndOutputIndex

func (c *VoucherRepository) FindVoucherByInputAndOutputIndex(
	ctx context.Context, inputIndex uint64, outputIndex uint64,
) (*model.ConvenienceVoucher, error)

func (*VoucherRepository) FindVoucherByOutputIndexAndAppContract

func (c *VoucherRepository) FindVoucherByOutputIndexAndAppContract(
	ctx context.Context, outputIndex uint64,
	appContract *common.Address,
) (*model.ConvenienceVoucher, error)

func (*VoucherRepository) SetExecuted

func (c *VoucherRepository) SetExecuted(
	ctx context.Context, voucher *model.ConvenienceVoucher,
) error

func (*VoucherRepository) SetProof

func (c *VoucherRepository) SetProof(
	ctx context.Context, voucher *model.ConvenienceVoucher,
) error

func (*VoucherRepository) UpdateExecuted

func (c *VoucherRepository) UpdateExecuted(
	ctx context.Context, inputIndex uint64, outputIndex uint64,
	executedValue bool,
) error

func (*VoucherRepository) UpdateVoucher

func (c *VoucherRepository) UpdateVoucher(
	ctx context.Context, voucher *model.ConvenienceVoucher,
) (*model.ConvenienceVoucher, error)

func (*VoucherRepository) VoucherCount

func (c *VoucherRepository) VoucherCount(
	ctx context.Context,
) (uint64, error)

Jump to

Keyboard shortcuts

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