db

package
v0.0.0-...-b7dcdf6 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const Limit = 100

Variables

This section is empty.

Functions

This section is empty.

Types

type CommentRepository

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

CommentRepository is a repository for the user entity

func NewCommentRepository

func NewCommentRepository(repository *repository) (*CommentRepository, error)

New creates a new CommentRepository

func (CommentRepository) Create

func (r CommentRepository) Create(ctx context.Context, entity *comment.Comment) error

Create saves a new album record in the database. It returns the ID of the newly inserted album record.

func (CommentRepository) Delete

func (r CommentRepository) Delete(ctx context.Context, id uint) error

Delete deletes an entity with the specified ID from the database.

func (CommentRepository) First

func (CommentRepository) Get

Get reads the album with the specified ID from the database.

func (CommentRepository) Query

func (r CommentRepository) Query(ctx context.Context, offset, limit uint) ([]comment.Comment, error)

Query retrieves the album records with the specified offset and limit from the database.

func (*CommentRepository) SetDefaultConditions

func (r *CommentRepository) SetDefaultConditions(conditions map[string]interface{})

type IRepository

type IRepository interface{}

IRepository is an interface of repository

func GetRepository

func GetRepository(dbase db.IDB, logger log.ILogger, entity string) (repo IRepository, err error)

GetRepository return a repository

type PostRepository

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

PostRepository is a repository for the user entity

func NewPostRepository

func NewPostRepository(repository *repository) (*PostRepository, error)

New creates a new PostRepository

func (PostRepository) Create

func (r PostRepository) Create(ctx context.Context, entity *post.Post) error

Create saves a new album record in the database. It returns the ID of the newly inserted album record.

func (PostRepository) Delete

func (r PostRepository) Delete(ctx context.Context, id uint) error

Delete deletes an entity with the specified ID from the database.

func (PostRepository) First

func (r PostRepository) First(ctx context.Context, entity *post.Post) (*post.Post, error)

func (PostRepository) Get

func (r PostRepository) Get(ctx context.Context, id uint) (*post.Post, error)

Get reads the album with the specified ID from the database.

func (PostRepository) Query

func (r PostRepository) Query(ctx context.Context, offset, limit uint) ([]post.Post, error)

Query retrieves the album records with the specified offset and limit from the database.

func (*PostRepository) SetDefaultConditions

func (r *PostRepository) SetDefaultConditions(conditions map[string]interface{})

func (PostRepository) Update

func (r PostRepository) Update(ctx context.Context, entity *post.Post) error

type SessionRepository

type SessionRepository struct {
	UserRepo user.IRepository
	// contains filtered or unexported fields
}

PostRepository is a repository for the user entity

func NewSessionRepository

func NewSessionRepository(dbase db.IDB, logger log.ILogger, userRepo user.IRepository) (*SessionRepository, error)

New creates a new PostRepository

func (SessionRepository) Create

func (r SessionRepository) Create(ctx context.Context, entity *session.Session) error

Create saves a new entity in the storage.

func (SessionRepository) Delete

func (r SessionRepository) Delete(ctx context.Context, id uint) error

Delete removes the entity with given ID from the storage.

func (SessionRepository) Get

Get reads the album with the specified ID from the database.

func (SessionRepository) GetByUserID

func (r SessionRepository) GetByUserID(ctx context.Context, userId uint) (*session.Session, error)

Get returns the Session with the specified user ID.

func (SessionRepository) GetVar

func (r SessionRepository) GetVar(session *session.Session, name string) (interface{}, bool)

func (SessionRepository) NewEntity

func (r SessionRepository) NewEntity(ctx context.Context, userId uint) (*session.Session, error)

func (*SessionRepository) SaveSession

func (r *SessionRepository) SaveSession(session *session.Session) error

func (*SessionRepository) SetDefaultConditions

func (r *SessionRepository) SetDefaultConditions(conditions map[string]interface{})

func (*SessionRepository) SetVar

func (r *SessionRepository) SetVar(session *session.Session, name string, val interface{}) error

func (SessionRepository) Update

func (r SessionRepository) Update(ctx context.Context, entity *session.Session) error

Update updates the entity with given ID in the storage.

type UserRepository

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

UserRepository is a repository for the user entity

func NewUserRepository

func NewUserRepository(repository *repository) (*UserRepository, error)

New creates a new UserRepository

func (UserRepository) Create

func (r UserRepository) Create(ctx context.Context, entity *user.User) error

Create saves a new album record in the database. It returns the ID of the newly inserted album record.

func (UserRepository) First

func (r UserRepository) First(ctx context.Context, entity *user.User) (*user.User, error)

func (UserRepository) Get

func (r UserRepository) Get(ctx context.Context, id uint) (*user.User, error)

Get reads the album with the specified ID from the database.

func (UserRepository) Query

func (r UserRepository) Query(ctx context.Context, offset, limit uint) ([]user.User, error)

Query retrieves the album records with the specified offset and limit from the database.

func (*UserRepository) SetDefaultConditions

func (r *UserRepository) SetDefaultConditions(conditions map[string]interface{})

type VoteRepository

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

VoteRepository is a repository for the user entity

func NewVoteRepository

func NewVoteRepository(repository *repository) (*VoteRepository, error)

New creates a new VoteRepository

func (VoteRepository) Create

func (r VoteRepository) Create(ctx context.Context, entity *vote.Vote) error

Create saves a new album record in the database. It returns the ID of the newly inserted album record.

func (VoteRepository) Delete

func (r VoteRepository) Delete(ctx context.Context, entity *vote.Vote) error

func (VoteRepository) First

func (r VoteRepository) First(ctx context.Context, entity *vote.Vote) (*vote.Vote, error)

func (VoteRepository) Get

func (r VoteRepository) Get(ctx context.Context, id uint) (*vote.Vote, error)

Get reads the album with the specified ID from the database.

func (VoteRepository) Query

func (r VoteRepository) Query(ctx context.Context, offset, limit uint) ([]vote.Vote, error)

Query retrieves the album records with the specified offset and limit from the database.

func (*VoteRepository) SetDefaultConditions

func (r *VoteRepository) SetDefaultConditions(conditions map[string]interface{})

func (VoteRepository) Update

func (r VoteRepository) Update(ctx context.Context, entity *vote.Vote) error

Jump to

Keyboard shortcuts

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