repositories

package
v0.0.0-...-baeefe5 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidTxType = errors.New("invalid tx type, tx type should be *sqlx.Tx")

Functions

This section is empty.

Types

type MongoCommentRepository

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

func NewMongoCommentRepository

func NewMongoCommentRepository(db *mongo.Database) *MongoCommentRepository

func (*MongoCommentRepository) FindByPostID

func (r *MongoCommentRepository) FindByPostID(ctx context.Context, postId int) ([]*models.Comment, error)

func (*MongoCommentRepository) InTransaction

func (r *MongoCommentRepository) InTransaction(ctx context.Context, fn func(context.Context) error) error

func (*MongoCommentRepository) Save

type MongoPostRepository

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

func NewMongoPostRepository

func NewMongoPostRepository(db *mongo.Database) *MongoPostRepository

func (*MongoPostRepository) FindByID

func (r *MongoPostRepository) FindByID(ctx context.Context, id int) (*models.Post, error)

func (*MongoPostRepository) InTransaction

func (r *MongoPostRepository) InTransaction(ctx context.Context, fn func(context.Context) error) error

func (*MongoPostRepository) Save

type SqlCommentRepository

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

func NewSqlCommentRepository

func NewSqlCommentRepository(db *sqlx.DB) *SqlCommentRepository

func (*SqlCommentRepository) FindByPostID

func (r *SqlCommentRepository) FindByPostID(ctx context.Context, postID int) ([]*models.Comment, error)

func (*SqlCommentRepository) InTransaction

func (r *SqlCommentRepository) InTransaction(ctx context.Context, fn func(context.Context) error) error

func (*SqlCommentRepository) Save

type SqlPostRepository

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

func NewSqlPostRepository

func NewSqlPostRepository(db *sqlx.DB) *SqlPostRepository

func (*SqlPostRepository) FindByID

func (r *SqlPostRepository) FindByID(ctx context.Context, id int) (*models.Post, error)

func (*SqlPostRepository) InTransaction

func (r *SqlPostRepository) InTransaction(ctx context.Context, fn func(context.Context) error) error

func (*SqlPostRepository) Save

func (r *SqlPostRepository) Save(ctx context.Context, p *models.Post) error

Jump to

Keyboard shortcuts

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