database

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Builder

func Builder(ctx *junodb.Context) (junodb.Database, error)

Builder allows to create a new Db instance implementing the database.Builder type

Types

type Db

type Db struct {
	*postgresql.Database
	// contains filtered or unexported fields
}

Db represents a PostgreSQL database with expanded features. so that it can properly store posts and other Desmos-related data.

func (*Db) AddUserToGroup

func (db *Db) AddUserToGroup(member types.UserGroupMember) error

AddUserToGroup adds a user to a user group

func (db *Db) DeleteAllApplicationLinks(height int64) error

DeleteAllApplicationLinks deletes all the application links that have a height equal or lower to the one given

func (db *Db) DeleteAllChainLinks(height int64) error

DeleteAllChainLinks deletes all the chain links having a height lower than the given one

func (db *Db) DeleteAllDefaultChainLinks(height int64) error

DeleteAllDefaultChainLinks removes all default chain links having a height lower than the one specified

func (*Db) DeleteAllPosts

func (db *Db) DeleteAllPosts(height int64, subspaceID uint64) error

DeleteAllPosts removes all the posts for the given subspace from the database

func (*Db) DeleteAllReactions

func (db *Db) DeleteAllReactions(height int64, subspaceID uint64, postID uint64) error

DeleteAllReactions removes all the reactions from the database

func (*Db) DeleteAllReasons

func (db *Db) DeleteAllReasons(height int64, subspaceID uint64) error

DeleteAllReasons deletes all the reasons from the database

func (*Db) DeleteAllRegisteredReactions

func (db *Db) DeleteAllRegisteredReactions(height int64, subspaceID uint64) error

func (*Db) DeleteAllRelationships

func (db *Db) DeleteAllRelationships(height int64, subspaceID uint64) error

DeleteAllRelationships allows to delete all the relationships associated with the given subspace from the database

func (*Db) DeleteAllReports

func (db *Db) DeleteAllReports(height int64, subspaceID uint64) error

DeleteAllReports removes all the reports from the database

func (*Db) DeleteAllSubspaces

func (db *Db) DeleteAllSubspaces(height int64) error

DeleteAllSubspaces removes all the subspaces from the database

func (*Db) DeleteAllUserBlocks

func (db *Db) DeleteAllUserBlocks(height int64, subspaceID uint64) error

DeleteAllUserBlocks allows to delete all the user blocks associated with the given subspace from the database

func (db *Db) DeleteApplicationLink(user, application, username string, height int64) error

DeleteApplicationLink allows to delete the application link associated to the given user, having the given application and username values

func (*Db) DeleteAuthzGrant

func (db *Db) DeleteAuthzGrant(granter string, grantee string, msgTypeURL string, height int64) error

DeleteAuthzGrant deletes the authz grant related to the given data

func (*Db) DeleteBlockage

func (db *Db) DeleteBlockage(block types.Blockage) error

DeleteBlockage allow to remove a previously saved user blockage

func (db *Db) DeleteChainLink(user string, externalAddress string, chainName string, height int64) error

DeleteChainLink removes from the database the chain link made for the given user and having the provided external address and linked to the chain with the given name

func (*Db) DeleteDTagTransferRequest

func (db *Db) DeleteDTagTransferRequest(request types.DTagTransferRequest) error

DeleteDTagTransferRequest deletes the DTag requests from sender to receiver

func (*Db) DeleteExpiredFeeGrants

func (db *Db) DeleteExpiredFeeGrants(time time.Time) error

DeleteExpiredFeeGrants removes the fee grants that expire before or on the given time

func (*Db) DeleteExpiredGrants

func (db *Db) DeleteExpiredGrants(time time.Time) error

DeleteExpiredGrants deletes all the authz grants that are expired before or on the provided date

func (*Db) DeleteFeeGrant

func (db *Db) DeleteFeeGrant(granter string, grantee string, height int64) error

DeleteFeeGrant removes the fee grant for the given data from the database

func (*Db) DeletePost

func (db *Db) DeletePost(height int64, subspaceID uint64, postID uint64) error

DeletePost removes the post with the given details from the database

func (*Db) DeletePostAttachment

func (db *Db) DeletePostAttachment(height int64, subspaceID uint64, postID uint64, attachmentID uint32) error

DeletePostAttachment removes the given post attachment from the database

func (*Db) DeleteProfile

func (db *Db) DeleteProfile(address string, height int64) error

DeleteProfile allows to delete the profile of the user having the given address

func (*Db) DeleteReaction

func (db *Db) DeleteReaction(height int64, subspaceID uint64, postID uint64, reactionID uint32) error

DeleteReaction removes the given reaction from the database

func (*Db) DeleteReason

func (db *Db) DeleteReason(height int64, subspaceID uint64, reasonID uint32) error

DeleteReason removes the reason having the given id from the database along with all the associated reports

func (*Db) DeleteRegisteredReaction

func (db *Db) DeleteRegisteredReaction(height int64, subspaceID uint64, reactionID uint32) error

DeleteRegisteredReaction removes the given registered reaction from the database

func (*Db) DeleteRelationship

func (db *Db) DeleteRelationship(relationship types.Relationship) error

DeleteRelationship allows to delete the relationship between the given sender and receiver on the specified subspace

func (*Db) DeleteReport

func (db *Db) DeleteReport(height int64, subspaceID uint64, reportID uint64) error

DeleteReport removes the report with the given id from the database

func (*Db) DeleteSection

func (db *Db) DeleteSection(height int64, subspaceID uint64, sectionID uint32) error

DeleteSection removes the given section from the subspace

func (*Db) DeleteSubspace

func (db *Db) DeleteSubspace(height int64, id uint64) error

DeleteSubspace removes the subspace with the given id from the database

func (*Db) DeleteUserGroup

func (db *Db) DeleteUserGroup(height int64, subspaceID uint64, groupID uint32) error

DeleteUserGroup removes the given user group from the subspace

func (*Db) DeleteUserPermission

func (db *Db) DeleteUserPermission(permission types.UserPermission) error

DeleteUserPermission removes the given permission from the database

func (*Db) GetApplicationLinkInfos

func (db *Db) GetApplicationLinkInfos() ([]types.ApplicationLinkInfo, error)

GetApplicationLinkInfos returns the information of all the stored application links

func (*Db) GetContract

func (db *Db) GetContract(address string) (*types.Contract, error)

GetContract returns the stored data of the contract with the given address

func (*Db) GetProfilesAddresses

func (db *Db) GetProfilesAddresses() ([]string, error)

GetProfilesAddresses returns all the addresses of the various profiles accounts

func (*Db) GetUserByAddress

func (db *Db) GetUserByAddress(address string) (*profilestypes.Profile, error)

GetUserByAddress returns the user row having the given address. If the user does not exist yet, returns nil instead.

func (*Db) GetUserTokens

func (db *Db) GetUserTokens(userAddress string) ([]types.NotificationToken, error)

GetUserTokens returns all the notifications tokens associated to all the devices of the user having the given address

func (*Db) HasPost

func (db *Db) HasPost(height int64, subspaceID uint64, postID uint64) (bool, error)

HasPost returns true if the post with the given id exists inside the database

func (*Db) HasValidator

func (db *Db) HasValidator(_ string) (bool, error)

HasValidator overrides postgresql.Database to perform a no-op

func (*Db) RemoveUserFromGroup

func (db *Db) RemoveUserFromGroup(member types.UserGroupMember) error

RemoveUserFromGroup removes the member from the given user group

func (db *Db) SaveApplicationLink(link types.ApplicationLink) error

SaveApplicationLink stores the given application link inside the database

func (*Db) SaveApplicationLinkScore

func (db *Db) SaveApplicationLinkScore(score *types.ProfileScore) error

SaveApplicationLinkScore stores the given profile score inside the database

func (*Db) SaveAuthzGrant

func (db *Db) SaveAuthzGrant(grant types.AuthzGrant) error

SaveAuthzGrant saves the given grant inside the database

func (db *Db) SaveChainLink(link types.ChainLink) error

SaveChainLink allows to store inside the db the provided chain link

func (*Db) SaveCommitSignatures

func (db *Db) SaveCommitSignatures(_ []*juno.CommitSig) error

SaveCommitSignatures overrides postgresql.Database to perform a no-op

func (*Db) SaveContract

func (db *Db) SaveContract(contract types.Contract) error

SaveContract stores the given contract data into the database

func (*Db) SaveDTagTransferRequest

func (db *Db) SaveDTagTransferRequest(request types.DTagTransferRequest) error

SaveDTagTransferRequest saves a new transfer request from sender to receiver

func (db *Db) SaveDefaultChainLink(chainLink types.ChainLink) error

SaveDefaultChainLink saves the given chain link as a default chain link

func (*Db) SaveFeeGrant

func (db *Db) SaveFeeGrant(grant types.FeeGrant) error

SaveFeeGrant stores the given grant inside the database

func (*Db) SaveNotification

func (db *Db) SaveNotification(recipient types.NotificationRecipient, data types.NotificationData) error

SaveNotification stores the given notification inside the database

func (*Db) SavePollAnswer

func (db *Db) SavePollAnswer(answer types.PollAnswer) error

SavePollAnswer stores the given answer inside the database

func (*Db) SavePost

func (db *Db) SavePost(post types.Post) error

SavePost stores the given post inside the database

func (*Db) SavePostAttachment

func (db *Db) SavePostAttachment(attachment types.PostAttachment) error

SavePostAttachment stores the given attachment inside the database

func (*Db) SavePostTx

func (db *Db) SavePostTx(tx types.PostTransaction) error

SavePostTx stores the given transaction into the database

func (*Db) SavePostsParams

func (db *Db) SavePostsParams(params types.PostsParams) error

SavePostsParams stores the given params inside the database

func (*Db) SaveProfile

func (db *Db) SaveProfile(profile *types.Profile) error

SaveProfile saves the given profile into the database, replacing any existing info. Returns the inserted row or an error if something goes wrong.

func (*Db) SaveProfilesParams

func (db *Db) SaveProfilesParams(params types.ProfilesParams) error

SaveProfilesParams allows to store the given profiles params

func (*Db) SaveReaction

func (db *Db) SaveReaction(reaction types.Reaction) error

SaveReaction stores the given reaction inside the database

func (*Db) SaveReactionParams

func (db *Db) SaveReactionParams(params types.ReactionParams) error

SaveReactionParams saves the given params inside the database

func (*Db) SaveReason

func (db *Db) SaveReason(reason types.Reason) error

SaveReason saves the given reason insinde the database

func (*Db) SaveRegisteredReaction

func (db *Db) SaveRegisteredReaction(reaction types.RegisteredReaction) error

SaveRegisteredReaction stores the given registered reaction inside the database

func (*Db) SaveRelationship

func (db *Db) SaveRelationship(relationship types.Relationship) error

SaveRelationship allows to save a relationship between the sender and receiver on the given subspace

func (*Db) SaveReport

func (db *Db) SaveReport(report types.Report) error

SaveReport saves the given report data inside the database

func (*Db) SaveReportsParams

func (db *Db) SaveReportsParams(params types.ReportsParams) error

SaveReportsParams saves the given reports params inside the database

func (*Db) SaveSection

func (db *Db) SaveSection(section types.Section) error

SaveSection stores the given section inside the database

func (*Db) SaveSubspace

func (db *Db) SaveSubspace(subspace types.Subspace) error

SaveSubspace stores the given subspace inside the database

func (*Db) SaveTip

func (db *Db) SaveTip(tip types.Tip) error

SaveTip saves the given tip inside the database

func (*Db) SaveToken

func (db *Db) SaveToken(token types.NotificationToken) error

SaveToken stores the given notification token inside the database

func (*Db) SaveTx

func (db *Db) SaveTx(_ *juno.Tx) error

SaveTx overrides postgresql.Database to perform a no-op

func (*Db) SaveUserBlock

func (db *Db) SaveUserBlock(block types.Blockage) error

SaveUserBlock allows to save a user blockage

func (*Db) SaveUserGroup

func (db *Db) SaveUserGroup(group types.UserGroup) error

SaveUserGroup stores the given group inside the database

func (*Db) SaveUserIfNotExisting

func (db *Db) SaveUserIfNotExisting(address string, height int64) error

SaveUserIfNotExisting creates a new user having the given address if it does not exist yet. Upon creating the user, returns that. If any error is raised during the process, returns that.

func (*Db) SaveUserPermission

func (db *Db) SaveUserPermission(permission types.UserPermission) error

SaveUserPermission stores the given permissions inside the database

func (*Db) SaveValidators

func (db *Db) SaveValidators(_ []*juno.Validator) error

SaveValidators overrides postgresql.Database to perform a no-op

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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