gateway

package
v0.0.0-...-6f95374 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Article

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

Article.

func NewArticle

func NewArticle(rdb *RDB) *Article

NewAArticle AArticleGatewayを生成するファクトリー関数.

func (*Article) AddToUser

func (gtw *Article) AddToUser(
	ctx context.Context,
	articleID article.ID,
	userID user.ID,
) error

func (*Article) Delete

func (gtw *Article) Delete(ctx context.Context, id article.ID) error

func (*Article) ExistsByUser

func (gtw *Article) ExistsByUser(
	ctx context.Context,
	articleID article.ID,
	userID user.ID,
) (bool, error)

func (*Article) Find

func (gtw *Article) Find(
	ctx context.Context,
	id article.ID,
) (model.Article, error)

Find ID指定で記事を取得するメソッド.

func (*Article) List

func (gtw *Article) List(
	ctx context.Context,
	index value.Index,
	size value.Size,
	filter ...value.Filter,
) ([]model.Article, error)

List 記事一覧を取得するメソッド.

func (*Article) ListByUser

func (gtw *Article) ListByUser(
	ctx context.Context,
	userID user.ID,
	index value.Index,
	size value.Size,
	filter ...value.Filter,
) ([]model.Article, error)

ListByUser ユーザーに紐づく記事を取得するメソッド.

func (*Article) RemoveFromUser

func (gtw *Article) RemoveFromUser(
	ctx context.Context,
	articleID article.ID,
	userID user.ID,
) error

func (*Article) Save

func (gtw *Article) Save(
	ctx context.Context,
	item model.Article,
) error

Save 記事を保存するメソッド.

type RDB

type RDB struct {
	*ent.Client
}

RDB RDBクライアント.

func (*RDB) IsDuplicatedError

func (r *RDB) IsDuplicatedError(ctx context.Context, err error) bool

IsDuplicatedError 重複エラーであるかを判定する関数.

type RDBClientMock

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

func NewRDBClientMock

func NewRDBClientMock(t *testing.T) *RDBClientMock

func (*RDBClientMock) Of

func (rm *RDBClientMock) Of(dsn string) (*RDB, error)

type RDBFactory

type RDBFactory interface {
	Of(dsn string) (*RDB, error)
}

RDBFactory RDBクライアントのファクトリ.

type User

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

func NewUser

func NewUser(rdb *RDB) *User

func (*User) Find

func (gtw *User) Find(
	ctx context.Context,
	id user.ID,
) (model.User, error)

func (*User) Save

func (gtw *User) Save(
	ctx context.Context,
	item model.User,
) error

Jump to

Keyboard shortcuts

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