data

package
v0.0.0-...-f6cc6f7 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EmailVerificationToken

type EmailVerificationToken struct {
	ID             int64      `db:"id"`
	UserID         int64      `db:"user_id"`
	Token          string     `db:"token"`
	CreatedAt      *time.Time `db:"created_at"`
	TokenExpiresAt *time.Time `db:"token_expires_at"`
}

type EmailVerificationTokens

type EmailVerificationTokens interface {
	New() EmailVerificationTokens

	Create(token EmailVerificationToken) (*EmailVerificationToken, error)
	Get() (*EmailVerificationToken, error)
	Delete() error

	FilterByID(id int64) EmailVerificationTokens
	FilterByUserID(id int64) EmailVerificationTokens
	FilterByToken(token string) EmailVerificationTokens

	Transaction(func() error) error
}

type OAuth2State

type OAuth2State struct {
	ID        int64      `db:"id"`
	State     string     `db:"state"`
	CreatedAt *time.Time `db:"created_at"`
	ValidTill *time.Time `db:"valid_till"`
}

type OAuth2States

type OAuth2States interface {
	New() OAuth2States

	Get() (*OAuth2State, error)
	Create(oAuth2State OAuth2State) (*OAuth2State, error)
	Delete() error

	FilterByID(id int64) OAuth2States
	FilterByState(state string) OAuth2States
}

type PasswordRecoveryToken

type PasswordRecoveryToken struct {
	ID             int64      `db:"id"`
	UserID         int64      `db:"user_id"`
	Token          string     `db:"token"`
	CreatedAt      *time.Time `db:"created_at"`
	TokenExpiresAt *time.Time `db:"token_expires_at"`
}

type PasswordRecoveryTokens

type PasswordRecoveryTokens interface {
	New() PasswordRecoveryTokens

	Create(token PasswordRecoveryToken) (*PasswordRecoveryToken, error)
	Update(token PasswordRecoveryToken) (*PasswordRecoveryToken, error)
	Get() (*PasswordRecoveryToken, error)
	Delete() error

	FilterByID(id int64) PasswordRecoveryTokens
	FilterByUserID(id int64) PasswordRecoveryTokens
	FilterByToken(token string) PasswordRecoveryTokens

	Transaction(func() error) error
}

type Post

type Post struct {
	ID          int64            `db:"id"`
	UserID      int64            `db:"user_id"`
	Title       string           `db:"title"`
	Body        string           `db:"body"`
	Status      types.PostStatus `db:"status"`
	TxHash      *string          `db:"tx_hash"`
	TxTimestamp *time.Time       `db:"tx_timestamp"`
}

type PostHeader

type PostHeader struct {
	ID          int64            `db:"id"`
	UserID      int64            `db:"user_id"`
	Title       string           `db:"title"`
	Status      types.PostStatus `db:"status"`
	TxHash      *string          `db:"tx_hash"`
	TxTimestamp *time.Time       `db:"tx_timestamp"`
}

type PostTransaction

type PostTransaction struct {
	ID     int64                 `db:"id"`
	PostID int64                 `db:"post_id"`
	Tx     *types.RLPTransaction `db:"tx"`
}

type PostTransactions

type PostTransactions interface {
	New() PostTransactions

	Create(tx PostTransaction) (*PostTransaction, error)
	Get() (*PostTransaction, error)
	Delete() error

	FilterByPostID(postID int64) PostTransactions
	Limit(limit uint64) PostTransactions

	Transaction(func() error) error
}

type Posts

type Posts interface {
	New() Posts

	Create(post Post) (*Post, error)
	Update(post Post) (*Post, error)
	Select() ([]Post, error)
	SelectHeaders() ([]PostHeader, error)
	Get() (*Post, error)
	Count() (int64, error)

	FilterByID(id int64) Posts
	FilterByUserID(userID int64) Posts
	FilterByStatus(status types.PostStatus) Posts

	WhereIDGreaterThan(id int64) Posts
	WhereIDLessThan(id int64) Posts

	JoinStarredPostsOnPostID() Posts
	FilterByStarredPostsUserID(userID int64) Posts

	JoinUsersOnID() Posts
	FilterByUsersAuthorID(authorID int64) Posts

	OrderByID(sorting types.Sorting) Posts
	Limit(limit uint64) Posts
	Offset(offset uint64) Posts

	Transaction(func() error) error
}

type RefreshToken

type RefreshToken struct {
	ID        int64      `db:"id"`
	UserID    int64      `db:"user_id"`
	Token     string     `db:"token"`
	CreatedAt *time.Time `db:"created_at"`
	ValidTill time.Time  `db:"valid_till"`
}

type RefreshTokens

type RefreshTokens interface {
	New() RefreshTokens

	Create(refreshToken RefreshToken) (*RefreshToken, error)
	Update(refreshToken RefreshToken) (*RefreshToken, error)
	Get() (*RefreshToken, error)
	Delete() error

	FilterByID(tokenID int64) RefreshTokens
	FilterByUserID(userID int64) RefreshTokens
	FilterByToken(token string) RefreshTokens

	Transaction(func() error) error
}

type StarredPost

type StarredPost struct {
	ID     int64 `db:"id"`
	UserID int64 `db:"user_id"`
	PostID int64 `db:"post_id"`
}

type StarredPosts

type StarredPosts interface {
	New() StarredPosts

	Create(starredPost StarredPost) (*StarredPost, error)
	Delete() error
	Get() (*StarredPost, error)

	FilterByUserID(int64) StarredPosts
	FilterByPostID(int64) StarredPosts

	Transaction(func() error) error
}

type User

type User struct {
	ID             int64                 `db:"id"`
	AuthorID       int64                 `db:"author_id"`
	Email          string                `db:"email"`
	Password       *string               `db:"password"`
	Name           string                `db:"name"`
	EmailVerified  bool                  `db:"email_verified"`
	OAuth2User     bool                  `db:"oauth2_user"`
	OAuth2Provider *types.OAuth2Provider `db:"oauth2_provider"`
	CreatedAt      *time.Time            `db:"created_at"`
	UpdatedAt      *time.Time            `db:"updated_at"`
}

type Users

type Users interface {
	New() Users

	CreateUserFromSignUp(user User) (*User, error)
	CreateUserFromOAuth2(user User) (*User, error)

	Update(user User) (*User, error)
	Get() (*User, error)

	FilterByID(id int64) Users
	FilterByEmail(email string) Users

	Transaction(func() error) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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