server

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package server is a generated GoMock package.

Package server is a generated GoMock package.

Package server is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BizError added in v0.4.0

type BizError struct {
	HTTPCode  uint
	FEMessage string
	Raw       error
}

BizError is the error allowed to show on frontend user side

func NewBizError added in v0.4.0

func NewBizError(raw error, code uint, message string) BizError

func (BizError) Error added in v0.4.0

func (e BizError) Error() string

type Feed

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

func NewFeed

func NewFeed(feedRepo FeedRepo, itemRepo ItemInFeedRepo) *Feed

func (Feed) All

func (f Feed) All(ctx context.Context) (*RespFeedAll, error)

func (Feed) CheckValidity

func (f Feed) CheckValidity(ctx context.Context, req *ReqFeedCheckValidity) (*RespFeedCheckValidity, error)

func (Feed) Create

func (f Feed) Create(ctx context.Context, req *ReqFeedCreate) error

func (Feed) Delete

func (f Feed) Delete(ctx context.Context, req *ReqFeedDelete) error

func (Feed) Get

func (f Feed) Get(ctx context.Context, req *ReqFeedGet) (*RespFeedGet, error)

func (Feed) Refresh

func (f Feed) Refresh(ctx context.Context, req *ReqFeedRefresh) error

func (Feed) Update

func (f Feed) Update(ctx context.Context, req *ReqFeedUpdate) error

type FeedForm

type FeedForm struct {
	ID        uint      `json:"id"`
	Name      *string   `json:"name"`
	Link      *string   `json:"link"`
	Failure   *string   `json:"failure"`
	Suspended *bool     `json:"suspended"`
	ReqProxy  *string   `json:"req_proxy"`
	UpdatedAt time.Time `json:"updated_at"`
	Group     GroupForm `json:"group"`
}

type FeedRepo

type FeedRepo interface {
	All() ([]*model.Feed, error)
	Get(id uint) (*model.Feed, error)
	Create(feed []*model.Feed) error
	Update(id uint, feed *model.Feed) error
	Delete(id uint) error
}

type FeedinGroupRepo

type FeedinGroupRepo interface {
	UpdateGroupID(from uint, to uint) error
}

type Group

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

func NewGroup

func NewGroup(groupRepo GroupRepo, feedRepo FeedinGroupRepo) *Group

func (Group) All

func (g Group) All(ctx context.Context) (*RespGroupAll, error)

func (Group) Create

func (g Group) Create(ctx context.Context, req *ReqGroupCreate) error

func (Group) Delete

func (g Group) Delete(ctx context.Context, req *ReqGroupDelete) error

func (Group) Update

func (g Group) Update(ctx context.Context, req *ReqGroupUpdate) error

type GroupForm

type GroupForm struct {
	ID   uint    `json:"id"`
	Name *string `json:"name"`
}

type GroupRepo

type GroupRepo interface {
	All() ([]*model.Group, error)
	Create(group *model.Group) error
	Update(id uint, group *model.Group) error
	Delete(id uint) error
}

type Item

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

func NewItem

func NewItem(repo ItemRepo) *Item

func (Item) Delete

func (i Item) Delete(ctx context.Context, req *ReqItemDelete) error

func (Item) Get

func (i Item) Get(ctx context.Context, req *ReqItemGet) (*RespItemGet, error)

func (Item) List

func (i Item) List(ctx context.Context, req *ReqItemList) (*RespItemList, error)

func (Item) UpdateBookmark added in v0.4.0

func (i Item) UpdateBookmark(ctx context.Context, req *ReqItemUpdateBookmark) error

func (Item) UpdateUnread added in v0.4.0

func (i Item) UpdateUnread(ctx context.Context, req *ReqItemUpdateUnread) error

type ItemFeed

type ItemFeed struct {
	ID   uint    `json:"id"`
	Name *string `json:"name"`
}

type ItemForm

type ItemForm struct {
	ID        uint       `json:"id"`
	Title     *string    `json:"title"`
	Link      *string    `json:"link"`
	GUID      *string    `json:"guid"`
	Content   *string    `json:"content"`
	Unread    *bool      `json:"unread"`
	Bookmark  *bool      `json:"bookmark"`
	PubDate   *time.Time `json:"pub_date"`
	UpdatedAt *time.Time `json:"updated_at"`
	Feed      ItemFeed   `json:"feed"`
}

type ItemInFeedRepo

type ItemInFeedRepo interface {
	DeleteByFeed(id uint) error
}

type ItemRepo

type ItemRepo interface {
	List(filter repo.ItemFilter, page, pageSize int) ([]*model.Item, int, error)
	Get(id uint) (*model.Item, error)
	Delete(id uint) error
	UpdateUnread(ids []uint, unread *bool) error
	UpdateBookmark(id uint, bookmark *bool) error
}

type MockFeedRepo

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

MockFeedRepo is a mock of FeedRepo interface.

func NewMockFeedRepo

func NewMockFeedRepo(ctrl *gomock.Controller) *MockFeedRepo

NewMockFeedRepo creates a new mock instance.

func (*MockFeedRepo) All

func (m *MockFeedRepo) All() ([]*model.Feed, error)

All mocks base method.

func (*MockFeedRepo) Create

func (m *MockFeedRepo) Create(feed []*model.Feed) error

Create mocks base method.

func (*MockFeedRepo) Delete

func (m *MockFeedRepo) Delete(id uint) error

Delete mocks base method.

func (*MockFeedRepo) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockFeedRepo) Get

func (m *MockFeedRepo) Get(id uint) (*model.Feed, error)

Get mocks base method.

func (*MockFeedRepo) Update

func (m *MockFeedRepo) Update(id uint, feed *model.Feed) error

Update mocks base method.

type MockFeedRepoMockRecorder

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

MockFeedRepoMockRecorder is the mock recorder for MockFeedRepo.

func (*MockFeedRepoMockRecorder) All

All indicates an expected call of All.

func (*MockFeedRepoMockRecorder) Create

func (mr *MockFeedRepoMockRecorder) Create(feed any) *gomock.Call

Create indicates an expected call of Create.

func (*MockFeedRepoMockRecorder) Delete

func (mr *MockFeedRepoMockRecorder) Delete(id any) *gomock.Call

Delete indicates an expected call of Delete.

func (*MockFeedRepoMockRecorder) Get

func (mr *MockFeedRepoMockRecorder) Get(id any) *gomock.Call

Get indicates an expected call of Get.

func (*MockFeedRepoMockRecorder) Update

func (mr *MockFeedRepoMockRecorder) Update(id, feed any) *gomock.Call

Update indicates an expected call of Update.

type MockFeedinGroupRepo

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

MockFeedinGroupRepo is a mock of FeedinGroupRepo interface.

func NewMockFeedinGroupRepo

func NewMockFeedinGroupRepo(ctrl *gomock.Controller) *MockFeedinGroupRepo

NewMockFeedinGroupRepo creates a new mock instance.

func (*MockFeedinGroupRepo) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockFeedinGroupRepo) UpdateGroupID

func (m *MockFeedinGroupRepo) UpdateGroupID(from, to uint) error

UpdateGroupID mocks base method.

type MockFeedinGroupRepoMockRecorder

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

MockFeedinGroupRepoMockRecorder is the mock recorder for MockFeedinGroupRepo.

func (*MockFeedinGroupRepoMockRecorder) UpdateGroupID

func (mr *MockFeedinGroupRepoMockRecorder) UpdateGroupID(from, to any) *gomock.Call

UpdateGroupID indicates an expected call of UpdateGroupID.

type MockGroupRepo

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

MockGroupRepo is a mock of GroupRepo interface.

func NewMockGroupRepo

func NewMockGroupRepo(ctrl *gomock.Controller) *MockGroupRepo

NewMockGroupRepo creates a new mock instance.

func (*MockGroupRepo) All

func (m *MockGroupRepo) All() ([]*model.Group, error)

All mocks base method.

func (*MockGroupRepo) Create

func (m *MockGroupRepo) Create(group *model.Group) error

Create mocks base method.

func (*MockGroupRepo) Delete

func (m *MockGroupRepo) Delete(id uint) error

Delete mocks base method.

func (*MockGroupRepo) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockGroupRepo) Update

func (m *MockGroupRepo) Update(id uint, group *model.Group) error

Update mocks base method.

type MockGroupRepoMockRecorder

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

MockGroupRepoMockRecorder is the mock recorder for MockGroupRepo.

func (*MockGroupRepoMockRecorder) All

All indicates an expected call of All.

func (*MockGroupRepoMockRecorder) Create

func (mr *MockGroupRepoMockRecorder) Create(group any) *gomock.Call

Create indicates an expected call of Create.

func (*MockGroupRepoMockRecorder) Delete

func (mr *MockGroupRepoMockRecorder) Delete(id any) *gomock.Call

Delete indicates an expected call of Delete.

func (*MockGroupRepoMockRecorder) Update

func (mr *MockGroupRepoMockRecorder) Update(id, group any) *gomock.Call

Update indicates an expected call of Update.

type MockItemInFeedRepo

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

MockItemInFeedRepo is a mock of ItemInFeedRepo interface.

func NewMockItemInFeedRepo

func NewMockItemInFeedRepo(ctrl *gomock.Controller) *MockItemInFeedRepo

NewMockItemInFeedRepo creates a new mock instance.

func (*MockItemInFeedRepo) DeleteByFeed

func (m *MockItemInFeedRepo) DeleteByFeed(id uint) error

DeleteByFeed mocks base method.

func (*MockItemInFeedRepo) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

type MockItemInFeedRepoMockRecorder

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

MockItemInFeedRepoMockRecorder is the mock recorder for MockItemInFeedRepo.

func (*MockItemInFeedRepoMockRecorder) DeleteByFeed

func (mr *MockItemInFeedRepoMockRecorder) DeleteByFeed(id any) *gomock.Call

DeleteByFeed indicates an expected call of DeleteByFeed.

type MockItemRepo

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

MockItemRepo is a mock of ItemRepo interface.

func NewMockItemRepo

func NewMockItemRepo(ctrl *gomock.Controller) *MockItemRepo

NewMockItemRepo creates a new mock instance.

func (*MockItemRepo) Delete

func (m *MockItemRepo) Delete(id uint) error

Delete mocks base method.

func (*MockItemRepo) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockItemRepo) Get

func (m *MockItemRepo) Get(id uint) (*model.Item, error)

Get mocks base method.

func (*MockItemRepo) List

func (m *MockItemRepo) List(filter repo.ItemFilter, page, pageSize int) ([]*model.Item, int, error)

List mocks base method.

func (*MockItemRepo) UpdateBookmark added in v0.7.3

func (m *MockItemRepo) UpdateBookmark(id uint, bookmark *bool) error

UpdateBookmark mocks base method.

func (*MockItemRepo) UpdateUnread added in v0.7.3

func (m *MockItemRepo) UpdateUnread(ids []uint, unread *bool) error

UpdateUnread mocks base method.

type MockItemRepoMockRecorder

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

MockItemRepoMockRecorder is the mock recorder for MockItemRepo.

func (*MockItemRepoMockRecorder) Delete

func (mr *MockItemRepoMockRecorder) Delete(id any) *gomock.Call

Delete indicates an expected call of Delete.

func (*MockItemRepoMockRecorder) Get

func (mr *MockItemRepoMockRecorder) Get(id any) *gomock.Call

Get indicates an expected call of Get.

func (*MockItemRepoMockRecorder) List

func (mr *MockItemRepoMockRecorder) List(filter, page, pageSize any) *gomock.Call

List indicates an expected call of List.

func (*MockItemRepoMockRecorder) UpdateBookmark added in v0.7.3

func (mr *MockItemRepoMockRecorder) UpdateBookmark(id, bookmark any) *gomock.Call

UpdateBookmark indicates an expected call of UpdateBookmark.

func (*MockItemRepoMockRecorder) UpdateUnread added in v0.7.3

func (mr *MockItemRepoMockRecorder) UpdateUnread(ids, unread any) *gomock.Call

UpdateUnread indicates an expected call of UpdateUnread.

type Paginate

type Paginate struct {
	PageSize int `query:"page_size" validate:"omitnil,min=0"`
	Page     int `query:"page" validate:"omitnil,min=0"`
}

type ReqFeedCheckValidity

type ReqFeedCheckValidity struct {
	Link string `json:"link" validate:"required"`
}

type ReqFeedCreate

type ReqFeedCreate struct {
	Feeds []struct {
		Name *string `json:"name" validate:"required"`
		Link *string `json:"link" validate:"required"`
	} `json:"feeds" validate:"required"`
	GroupID uint `json:"group_id" validate:"required"`
}

type ReqFeedDelete

type ReqFeedDelete struct {
	ID uint `param:"id" validate:"required"`
}

type ReqFeedGet

type ReqFeedGet struct {
	ID uint `param:"id" validate:"required"`
}

type ReqFeedRefresh

type ReqFeedRefresh struct {
	ID  *uint `json:"id"`
	All *bool `json:"all"`
}

type ReqFeedUpdate

type ReqFeedUpdate struct {
	ID        uint    `param:"id" validate:"required"`
	Name      *string `json:"name"`
	Link      *string `json:"link"`
	Suspended *bool   `json:"suspended"`
	ReqProxy  *string `json:"req_proxy"`
	GroupID   *uint   `json:"group_id"`
}

type ReqGroupCreate

type ReqGroupCreate struct {
	Name *string `json:"name" validate:"required"`
}

type ReqGroupDelete

type ReqGroupDelete struct {
	ID uint `param:"id" validate:"required"`
}

type ReqGroupUpdate

type ReqGroupUpdate struct {
	ID   uint    `param:"id" validate:"required"`
	Name *string `json:"name" validate:"required"`
}

type ReqItemDelete

type ReqItemDelete struct {
	ID uint `param:"id" validate:"required"`
}

type ReqItemGet

type ReqItemGet struct {
	ID uint `param:"id" validate:"required"`
}

type ReqItemList

type ReqItemList struct {
	Paginate
	Keyword  *string `query:"keyword"`
	FeedID   *uint   `query:"feed_id"`
	Unread   *bool   `query:"unread"`
	Bookmark *bool   `query:"bookmark"`
}

type ReqItemUpdateBookmark added in v0.4.0

type ReqItemUpdateBookmark struct {
	ID       uint  `param:"id" validate:"required"`
	Bookmark *bool `json:"bookmark" validate:"required"`
}

type ReqItemUpdateUnread added in v0.4.0

type ReqItemUpdateUnread struct {
	IDs    []uint `json:"ids" validate:"required"`
	Unread *bool  `json:"unread" validate:"required"`
}

type RespFeedAll

type RespFeedAll struct {
	Feeds []*FeedForm `json:"feeds"`
}

type RespFeedCheckValidity

type RespFeedCheckValidity struct {
	FeedLinks []ValidityItem `json:"feed_links"`
}

type RespFeedGet

type RespFeedGet FeedForm

type RespGroupAll

type RespGroupAll struct {
	Groups []*GroupForm `json:"groups"`
}

type RespItemGet

type RespItemGet ItemForm

type RespItemList

type RespItemList struct {
	Total *int        `json:"total"`
	Items []*ItemForm `json:"items"`
}

type ValidityItem

type ValidityItem struct {
	Title *string `json:"title"`
	Link  *string `json:"link"`
}

Jump to

Keyboard shortcuts

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