bindings

package
v0.0.0-...-8323f46 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2023 License: AGPL-3.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Challenge

type Challenge struct {
	Address   string
	Message   string
	ExpiresAt int64
}

type Comment

type Comment struct {
	ID                        int64
	ThreadID                  int64
	RepliedToCommentID        pgtype.Int8
	Address                   string
	Content                   string
	ImageFileName             string
	ImageOriginalUrl          string
	ImageOriginalContentType  string
	ImageFormattedUrl         string
	ImageFormattedContentType string
	Votes                     int64
	IsDeleted                 bool
	CreatedAt                 pgtype.Timestamp
	DeletedAt                 pgtype.Timestamp
}

type CommentVote

type CommentVote struct {
	Address   string
	CommentID int64
	CreatedAt pgtype.Timestamp
	UpdatedAt pgtype.Timestamp
	Vote      int16
}

type CreateCommentDownVoteParams

type CreateCommentDownVoteParams struct {
	Address     string
	CommentID   int64
	ToTimestamp float64
}

type CreateCommentParams

type CreateCommentParams struct {
	Address                   string
	ThreadID                  int64
	RepliedToCommentID        pgtype.Int8
	Content                   string
	ImageFileName             string
	ImageOriginalUrl          string
	ImageOriginalContentType  string
	ImageFormattedUrl         string
	ImageFormattedContentType string
}

type CreateCommentUnVoteParams

type CreateCommentUnVoteParams struct {
	Address     string
	CommentID   int64
	ToTimestamp float64
}

type CreateCommentUpVoteParams

type CreateCommentUpVoteParams struct {
	Address     string
	CommentID   int64
	ToTimestamp float64
}

type CreateThreadDownVoteParams

type CreateThreadDownVoteParams struct {
	Address     string
	ThreadID    int64
	ToTimestamp float64
}

type CreateThreadParams

type CreateThreadParams struct {
	Address                   string
	Title                     string
	Content                   string
	ImageFileName             string
	ImageOriginalUrl          string
	ImageOriginalContentType  string
	ImageFormattedUrl         string
	ImageFormattedContentType string
}

type CreateThreadUnVoteParams

type CreateThreadUnVoteParams struct {
	Address     string
	ThreadID    int64
	ToTimestamp float64
}

type CreateThreadUpVoteParams

type CreateThreadUpVoteParams struct {
	Address     string
	ThreadID    int64
	ToTimestamp float64
}

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
	CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error)
}

type DeleteTransfersParams

type DeleteTransfersParams struct {
	BlockNumber   pgtype.Numeric
	BlockNumber_2 pgtype.Numeric
}

type GetCommentRow

type GetCommentRow struct {
	ID                            int64
	ThreadID                      int64
	RepliedToCommentID            pgtype.Int8
	Address                       string
	Content                       string
	ImageFileName                 string
	ImageOriginalUrl              string
	ImageOriginalContentType      string
	ImageFormattedUrl             string
	ImageFormattedContentType     string
	Votes                         int64
	IsDeleted                     bool
	CreatedAt                     pgtype.Timestamp
	DeletedAt                     pgtype.Timestamp
	RID                           pgtype.Int8
	RAddress                      pgtype.Text
	RContent                      pgtype.Text
	RImageFileName                pgtype.Text
	RImageOriginalUrl             pgtype.Text
	RImageOriginalContentType     pgtype.Text
	RImageFormattedUrl            pgtype.Text
	RImageFormattedContentType    pgtype.Text
	RIsDeleted                    pgtype.Bool
	RCreatedAt                    pgtype.Timestamp
	RDeletedAt                    pgtype.Timestamp
	Address_2                     string
	EnsName                       pgtype.Text
	EnsAvatarFileName             pgtype.Text
	EnsAvatarOriginalUrl          pgtype.Text
	EnsAvatarOriginalContentType  pgtype.Text
	EnsAvatarFormattedUrl         pgtype.Text
	EnsAvatarFormattedContentType pgtype.Text
	Reputation                    pgtype.Numeric
	UserCreatedAt                 pgtype.Timestamp
	UserUpdatedAt                 pgtype.Timestamp
}

type GetCommentsParams

type GetCommentsParams struct {
	ThreadID int64
	Column2  int64
	Column3  int64
}

type GetCommentsRow

type GetCommentsRow struct {
	ID                            int64
	ThreadID                      int64
	RepliedToCommentID            pgtype.Int8
	Address                       string
	Content                       string
	ImageFileName                 string
	ImageOriginalUrl              string
	ImageOriginalContentType      string
	ImageFormattedUrl             string
	ImageFormattedContentType     string
	Votes                         int64
	IsDeleted                     bool
	CreatedAt                     pgtype.Timestamp
	DeletedAt                     pgtype.Timestamp
	RID                           pgtype.Int8
	RAddress                      pgtype.Text
	RContent                      pgtype.Text
	RImageFileName                pgtype.Text
	RImageOriginalUrl             pgtype.Text
	RImageOriginalContentType     pgtype.Text
	RImageFormattedUrl            pgtype.Text
	RImageFormattedContentType    pgtype.Text
	RIsDeleted                    pgtype.Bool
	RCreatedAt                    pgtype.Timestamp
	RDeletedAt                    pgtype.Timestamp
	Address_2                     string
	EnsName                       pgtype.Text
	EnsAvatarFileName             pgtype.Text
	EnsAvatarOriginalUrl          pgtype.Text
	EnsAvatarOriginalContentType  pgtype.Text
	EnsAvatarFormattedUrl         pgtype.Text
	EnsAvatarFormattedContentType pgtype.Text
	Reputation                    pgtype.Numeric
	UserCreatedAt                 pgtype.Timestamp
	UserUpdatedAt                 pgtype.Timestamp
	FullCount                     int64
}

type GetThreadRow

type GetThreadRow struct {
	ID                            int64
	Address                       string
	Title                         string
	Content                       string
	ImageFileName                 string
	ImageOriginalUrl              string
	ImageOriginalContentType      string
	ImageFormattedUrl             string
	ImageFormattedContentType     string
	Votes                         int64
	IsDeleted                     bool
	CreatedAt                     pgtype.Timestamp
	DeletedAt                     pgtype.Timestamp
	Address_2                     string
	EnsName                       pgtype.Text
	EnsAvatarFileName             pgtype.Text
	EnsAvatarOriginalUrl          pgtype.Text
	EnsAvatarOriginalContentType  pgtype.Text
	EnsAvatarFormattedUrl         pgtype.Text
	EnsAvatarFormattedContentType pgtype.Text
	Reputation                    pgtype.Numeric
	UserCreatedAt                 pgtype.Timestamp
	UserUpdatedAt                 pgtype.Timestamp
}

type GetThreadsRow

type GetThreadsRow struct {
	ID                            int64
	Address                       string
	Title                         string
	Content                       string
	ImageFileName                 string
	ImageOriginalUrl              string
	ImageOriginalContentType      string
	ImageFormattedUrl             string
	ImageFormattedContentType     string
	Votes                         int64
	IsDeleted                     bool
	CreatedAt                     pgtype.Timestamp
	DeletedAt                     pgtype.Timestamp
	Address_2                     string
	EnsName                       pgtype.Text
	EnsAvatarFileName             pgtype.Text
	EnsAvatarOriginalUrl          pgtype.Text
	EnsAvatarOriginalContentType  pgtype.Text
	EnsAvatarFormattedUrl         pgtype.Text
	EnsAvatarFormattedContentType pgtype.Text
	Reputation                    pgtype.Numeric
	UserCreatedAt                 pgtype.Timestamp
	UserUpdatedAt                 pgtype.Timestamp
}

type IndexerProgress

type IndexerProgress struct {
	Version          string
	LastIndexedBlock pgtype.Numeric
	IndexedOn        pgtype.Timestamp
}

type InsertTransfersParams

type InsertTransfersParams struct {
	BlockNumber   pgtype.Numeric
	TransactionID string
	LogIndex      int64
	FromAddress   string
	ToAddress     string
	Amount        pgtype.Numeric
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) AddReputation

func (q *Queries) AddReputation(ctx context.Context, dollar_1 []string) error

if the user address is the to_address, then add the amount

func (*Queries) AggregateCommentVotes

func (q *Queries) AggregateCommentVotes(ctx context.Context, commentID int64) error

func (*Queries) AggregateThreadVotes

func (q *Queries) AggregateThreadVotes(ctx context.Context, threadID int64) error

func (*Queries) CreateComment

func (q *Queries) CreateComment(ctx context.Context, arg CreateCommentParams) (int64, error)

func (*Queries) CreateCommentDownVote

func (q *Queries) CreateCommentDownVote(ctx context.Context, arg CreateCommentDownVoteParams) error

func (*Queries) CreateCommentUnVote

func (q *Queries) CreateCommentUnVote(ctx context.Context, arg CreateCommentUnVoteParams) error

func (*Queries) CreateCommentUpVote

func (q *Queries) CreateCommentUpVote(ctx context.Context, arg CreateCommentUpVoteParams) error

func (*Queries) CreateThread

func (q *Queries) CreateThread(ctx context.Context, arg CreateThreadParams) (int64, error)

func (*Queries) CreateThreadDownVote

func (q *Queries) CreateThreadDownVote(ctx context.Context, arg CreateThreadDownVoteParams) error

only update the vote if the incoming vote is newer than the current vote

func (*Queries) CreateThreadUnVote

func (q *Queries) CreateThreadUnVote(ctx context.Context, arg CreateThreadUnVoteParams) error

func (*Queries) CreateThreadUpVote

func (q *Queries) CreateThreadUpVote(ctx context.Context, arg CreateThreadUpVoteParams) error

func (*Queries) DeductReputation

func (q *Queries) DeductReputation(ctx context.Context, dollar_1 []string) error

if the user address is the from_address, then deduct the amount

func (*Queries) DeleteComment

func (q *Queries) DeleteComment(ctx context.Context, id int64) (int64, error)

func (*Queries) DeleteThread

func (q *Queries) DeleteThread(ctx context.Context, id int64) (int64, error)

func (*Queries) DeleteTransfers

func (q *Queries) DeleteTransfers(ctx context.Context, arg DeleteTransfersParams) error

func (*Queries) GetChallenge

func (q *Queries) GetChallenge(ctx context.Context, address string) (Challenge, error)

func (*Queries) GetComment

func (q *Queries) GetComment(ctx context.Context, id int64) (GetCommentRow, error)

func (*Queries) GetComments

func (q *Queries) GetComments(ctx context.Context, arg GetCommentsParams) ([]GetCommentsRow, error)

func (*Queries) GetLastIndexedBlock

func (q *Queries) GetLastIndexedBlock(ctx context.Context) (pgtype.Numeric, error)

func (*Queries) GetThread

func (q *Queries) GetThread(ctx context.Context, id int64) (GetThreadRow, error)

func (*Queries) GetThreads

func (q *Queries) GetThreads(ctx context.Context, dollar_1 int64) ([]GetThreadsRow, error)

Order by random is not performant as we need to do a full table scan. Move to TABLESAMPLE SYSTEM_ROWS(N) when performance becomes an issue. Table sample is not random enough until the table gets big. https://www.postgresql.org/docs/current/tsm-system-rows.html

func (*Queries) GetUser

func (q *Queries) GetUser(ctx context.Context, address string) (User, error)

func (*Queries) InsertTransfers

func (q *Queries) InsertTransfers(ctx context.Context, arg []InsertTransfersParams) (int64, error)

func (*Queries) UpdateChallenge

func (q *Queries) UpdateChallenge(ctx context.Context, arg UpdateChallengeParams) error

func (*Queries) UpdateLastIndexedBlock

func (q *Queries) UpdateLastIndexedBlock(ctx context.Context, lastIndexedBlock pgtype.Numeric) error

func (*Queries) UpdateUser

func (q *Queries) UpdateUser(ctx context.Context, arg UpdateUserParams) error

func (*Queries) UpsertUser

func (q *Queries) UpsertUser(ctx context.Context, address string) error

upsert user every time they signin so we don't have to check if they exist

func (*Queries) WithTx

func (q *Queries) WithTx(tx pgx.Tx) *Queries

func (*Queries) ZeroReputation

func (q *Queries) ZeroReputation(ctx context.Context, dollar_1 []string) error

set the reputation of all users to 0

type Thread

type Thread struct {
	ID                        int64
	Address                   string
	Title                     string
	Content                   string
	ImageFileName             string
	ImageOriginalUrl          string
	ImageOriginalContentType  string
	ImageFormattedUrl         string
	ImageFormattedContentType string
	Votes                     int64
	IsDeleted                 bool
	CreatedAt                 pgtype.Timestamp
	DeletedAt                 pgtype.Timestamp
}

type ThreadVote

type ThreadVote struct {
	Address   string
	ThreadID  int64
	CreatedAt pgtype.Timestamp
	UpdatedAt pgtype.Timestamp
	Vote      int16
}

type Transfer

type Transfer struct {
	BlockNumber   pgtype.Numeric
	TransactionID string
	LogIndex      int64
	FromAddress   string
	ToAddress     string
	Amount        pgtype.Numeric
}

type UpdateChallengeParams

type UpdateChallengeParams struct {
	Address   string
	Message   string
	ExpiresAt int64
}

type UpdateUserParams

type UpdateUserParams struct {
	Address                       string
	EnsName                       pgtype.Text
	EnsAvatarFileName             pgtype.Text
	EnsAvatarOriginalUrl          pgtype.Text
	EnsAvatarOriginalContentType  pgtype.Text
	EnsAvatarFormattedUrl         pgtype.Text
	EnsAvatarFormattedContentType pgtype.Text
}

type User

type User struct {
	Address                       string
	EnsName                       pgtype.Text
	CreatedAt                     pgtype.Timestamp
	UpdatedAt                     pgtype.Timestamp
	Reputation                    pgtype.Numeric
	EnsAvatarFileName             pgtype.Text
	EnsAvatarOriginalUrl          pgtype.Text
	EnsAvatarOriginalContentType  pgtype.Text
	EnsAvatarFormattedUrl         pgtype.Text
	EnsAvatarFormattedContentType pgtype.Text
}

Jump to

Keyboard shortcuts

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