repository

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RelationshipRequestStatusRequest = 1
	RelationshipRequestStatusOK      = 2
	RelationshipRequestStatusNG      = 3
)

Variables

This section is empty.

Functions

func FirebaseApp

func FirebaseApp(ctx context.Context) (*firebase.App, error)

FirebaseApp Firebase App

func FirestoreClient

func FirestoreClient(ctx context.Context) (*firestore.Client, error)

FirestoreClient Firestore Client

func GrpcErrorStatusCode

func GrpcErrorStatusCode(err error) codes.Code

Types

type Auth

type Auth struct {
	ID string
}

type AuthRepository

type AuthRepository struct {
}

func (*AuthRepository) Delete

Delete Authを削除する

type AuthRepositoryInterface

type AuthRepositoryInterface interface {
	Delete(ctx context.Context, f *firestore.Client, tx *firestore.Transaction, uid string) error
}

func NewAuthRepository

func NewAuthRepository() AuthRepositoryInterface

type CommonRepository

type CommonRepository struct {
}

func (*CommonRepository) Commit

func (re *CommonRepository) Commit(ctx context.Context, batch *firestore.BulkWriter)

Commit コミットする

type CommonRepositoryInterface

type CommonRepositoryInterface interface {
	Commit(ctx context.Context, batch *firestore.BulkWriter)
}

func NewCommonRepository

func NewCommonRepository() CommonRepositoryInterface

type InviteRepository

type InviteRepository struct {
}

func (*InviteRepository) Create

Create 招待を作成する

func (*InviteRepository) Delete

Delete アイテムを削除する

func (*InviteRepository) DeleteByUserID

func (re *InviteRepository) DeleteByUserID(ctx context.Context, f *firestore.Client, tx *firestore.Transaction, userID string) error

DeleteByUserID ユーザーIDから削除する

func (*InviteRepository) Find

func (re *InviteRepository) Find(ctx context.Context, f *firestore.Client, code string) (*model.Invite, error)

Find 取得する

func (*InviteRepository) FindByUserID

func (re *InviteRepository) FindByUserID(ctx context.Context, f *firestore.Client, userID string) (*model.Invite, error)

FindByUserID ユーザーIDから取得する

type InviteRepositoryInterface

type InviteRepositoryInterface interface {
	Create(ctx context.Context, f *firestore.Client, tx *firestore.Transaction, i *model.Invite) error
	Delete(ctx context.Context, f *firestore.Client, tx *firestore.Transaction, code string) error
	DeleteByUserID(ctx context.Context, f *firestore.Client, tx *firestore.Transaction, userID string) error
	Find(ctx context.Context, f *firestore.Client, code string) (*model.Invite, error)
	FindByUserID(ctx context.Context, f *firestore.Client, userID string) (*model.Invite, error)
}

func NewInviteRepository

func NewInviteRepository() InviteRepositoryInterface

type ItemKey

type ItemKey struct {
	UserID string
}

type ItemRepository

type ItemRepository struct {
}

func (*ItemRepository) Create

func (re *ItemRepository) Create(ctx context.Context, f *firestore.Client, userID string, i *model.Item) error

Create アイテムを作成する

func (*ItemRepository) Delete

func (re *ItemRepository) Delete(ctx context.Context, f *firestore.Client, userID string, i *model.DeleteItem) error

Delete アイテムを削除する

func (*ItemRepository) GetCountUserMultipleInPeriod added in v1.7.0

func (re *ItemRepository) GetCountUserMultipleInPeriod(ctx context.Context, f *firestore.Client, sip SearchItemParam) (int, error)

GetCountUserMultipleInPeriod 期間でアイテムの総数を取得する

func (*ItemRepository) GetItem

func (re *ItemRepository) GetItem(ctx context.Context, f *firestore.Client, userID string, id string) (*model.Item, error)

GetItem アイテムを取得する

func (*ItemRepository) GetItemUserMultipleInPeriod

func (re *ItemRepository) GetItemUserMultipleInPeriod(ctx context.Context, f *firestore.Client, sip SearchItemParam, first int, cursor ItemsInPeriodCursor) ([]*model.Item, error)

GetItemUserMultipleInPeriod 期間でアイテムを取得する

func (*ItemRepository) GetItemsInDate

func (re *ItemRepository) GetItemsInDate(ctx context.Context, f *firestore.Client, userID string, date time.Time) ([]*model.Item, error)

GetItemsInDate 日付でアイテムを取得する

func (*ItemRepository) GetItemsInPeriod

func (re *ItemRepository) GetItemsInPeriod(ctx context.Context, f *firestore.Client, userID string, startDate time.Time, endDate time.Time, first int, cursor ItemsInPeriodCursor) ([]*model.Item, error)

GetItemsInPeriod 期間でアイテムを取得する

func (*ItemRepository) Update

func (re *ItemRepository) Update(ctx context.Context, f *firestore.Client, userID string, i *model.UpdateItem, updatedAt time.Time) error

Update アイテムを更新する

type ItemRepositoryInterface

type ItemRepositoryInterface interface {
	Create(ctx context.Context, f *firestore.Client, userID string, i *model.Item) error
	Update(ctx context.Context, f *firestore.Client, userID string, i *model.UpdateItem, updatedAt time.Time) error
	Delete(ctx context.Context, f *firestore.Client, userID string, i *model.DeleteItem) error
	GetItem(ctx context.Context, f *firestore.Client, userID string, id string) (*model.Item, error)
	GetItemsInDate(ctx context.Context, f *firestore.Client, userID string, date time.Time) ([]*model.Item, error)
	GetItemsInPeriod(ctx context.Context, f *firestore.Client, userID string, stertDate time.Time, endDate time.Time, first int, cursor ItemsInPeriodCursor) ([]*model.Item, error)
	GetItemUserMultipleInPeriod(ctx context.Context, f *firestore.Client, sip SearchItemParam, first int, cursor ItemsInPeriodCursor) ([]*model.Item, error)
	GetCountUserMultipleInPeriod(ctx context.Context, f *firestore.Client, sip SearchItemParam) (int, error)
}

func NewItemRepository

func NewItemRepository() ItemRepositoryInterface

type ItemsInPeriodCursor

type ItemsInPeriodCursor struct {
	ID     string
	UserID string
}

type PushTokenRepository

type PushTokenRepository struct {
}

func (*PushTokenRepository) Create

func (re *PushTokenRepository) Create(ctx context.Context, f *firestore.Client, userID string, i *model.PushToken) error

func (*PushTokenRepository) GetItems

func (re *PushTokenRepository) GetItems(ctx context.Context, f *firestore.Client, userID string) ([]*model.PushToken, error)

func (*PushTokenRepository) GetTokens

func (re *PushTokenRepository) GetTokens(ctx context.Context, f *firestore.Client, userID string) []string

type PushTokenRepositoryInterface

type PushTokenRepositoryInterface interface {
	Create(ctx context.Context, f *firestore.Client, userID string, i *model.PushToken) error
	GetItems(ctx context.Context, f *firestore.Client, userID string) ([]*model.PushToken, error)
	GetTokens(ctx context.Context, f *firestore.Client, userID string) []string
}

func NewPushTokenRepository

func NewPushTokenRepository() PushTokenRepositoryInterface

NewPushTokenRepository is Create new PushTokenRepository

type RelationshipCursor

type RelationshipCursor struct {
	FollowerID string
	FollowedID string
}

type RelationshipData

type RelationshipData struct {
	ID         string
	FollowerID string
	FollowedID string
	CreatedAt  time.Time
	UpdatedAt  time.Time
}

type RelationshipInterface

type RelationshipInterface interface {
	Create(ctx context.Context, f *firestore.Client, tx *firestore.Transaction, i *model.Relationship) error
	Delete(ctx context.Context, f *firestore.Client, tx *firestore.Transaction, i *model.Relationship) error
	FindByFollowedID(ctx context.Context, f *firestore.Client, userID string, first int, cursor RelationshipCursor) ([]*model.Relationship, error)
	ExistByFollowedID(ctx context.Context, f *firestore.Client, userID string) (bool, error)
}

func NewRelationshipRepository

func NewRelationshipRepository() RelationshipInterface

type RelationshipRepository

type RelationshipRepository struct {
}

func (*RelationshipRepository) Create

Create 作成する

func (*RelationshipRepository) Delete

Delete 削除する

func (*RelationshipRepository) ExistByFollowedID

func (re *RelationshipRepository) ExistByFollowedID(ctx context.Context, f *firestore.Client, userID string) (bool, error)

ExistByFollowedID フォローしているか確認

func (*RelationshipRepository) Find

Find 取得する

func (*RelationshipRepository) FindByFollowedID

func (re *RelationshipRepository) FindByFollowedID(ctx context.Context, f *firestore.Client, userID string, first int, cursor RelationshipCursor) ([]*model.Relationship, error)

FindByFollowedID ページングで取得する

type RelationshipRequestCursor

type RelationshipRequestCursor struct {
	FollowerID string
	FollowedID string
}

type RelationshipRequestData

type RelationshipRequestData struct {
	ID         string
	FollowerID string
	FollowedID string
	Status     int
	CreatedAt  time.Time
	UpdatedAt  time.Time
}

type RelationshipRequestInterface

type RelationshipRequestInterface interface {
	Create(ctx context.Context, f *firestore.Client, i *model.RelationshipRequest) error
	Update(ctx context.Context, f *firestore.Client, tx *firestore.Transaction, i *model.RelationshipRequest) error
	DeleteByFollowedID(ctx context.Context, f *firestore.Client, tx *firestore.Transaction, userID string) error
	DeleteByFollowerID(ctx context.Context, f *firestore.Client, tx *firestore.Transaction, userID string) error
	Find(ctx context.Context, f *firestore.Client, i *model.RelationshipRequest) (*model.RelationshipRequest, error)
	FindByFollowedID(ctx context.Context, f *firestore.Client, userID string, first int, cursor RelationshipRequestCursor) ([]*model.RelationshipRequest, error)
}

func NewRelationshipRequestRepository

func NewRelationshipRequestRepository() RelationshipRequestInterface

type RelationshipRequestRepository

type RelationshipRequestRepository struct {
}

func (*RelationshipRequestRepository) Create

Create 作成する

func (*RelationshipRequestRepository) DeleteByFollowedID

func (re *RelationshipRequestRepository) DeleteByFollowedID(ctx context.Context, f *firestore.Client, tx *firestore.Transaction, userID string) error

DeleteByFollowedID ユーザーIDから削除する

func (*RelationshipRequestRepository) DeleteByFollowerID

func (re *RelationshipRequestRepository) DeleteByFollowerID(ctx context.Context, f *firestore.Client, tx *firestore.Transaction, userID string) error

DeleteByFollowerID ユーザーIDから削除する

func (*RelationshipRequestRepository) Find

Find 取得する

func (*RelationshipRequestRepository) FindByFollowedID

FindByFollowedID ページングで取得する

func (*RelationshipRequestRepository) Update

Update 更新する

type SearchItemParam

type SearchItemParam struct {
	UserID     []string
	StartDate  time.Time
	EndDate    time.Time
	Like       bool
	Dislike    bool
	CategoryID int
}

type User

type User struct {
	ID          string
	FirebaseUID string
	DisplayName string
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

type UserRepository

type UserRepository struct {
}

func (*UserRepository) Create

func (re *UserRepository) Create(ctx context.Context, f *firestore.Client, u *model.User) error

Create ユーザーを作成する

func (*UserRepository) Delete

Delete ユーザーを削除する

func (*UserRepository) ExistByFirebaseUID

func (re *UserRepository) ExistByFirebaseUID(ctx context.Context, f *firestore.Client, fUID string) (bool, error)

ExistByFirebaseUID FirebaseユーザーIDが存在するか取得する

func (*UserRepository) FindByFirebaseUID

func (re *UserRepository) FindByFirebaseUID(ctx context.Context, f *firestore.Client, fUID string) (*model.User, error)

FindByFirebaseUID FirebaseユーザーIDから取得する

func (*UserRepository) FindByUID

func (re *UserRepository) FindByUID(ctx context.Context, f *firestore.Client, uid string) (*model.User, error)

FindByUID ユーザーIDから取得する

func (*UserRepository) FindDatabaseDataByUID

func (re *UserRepository) FindDatabaseDataByUID(ctx context.Context, f *firestore.Client, uid string) (*User, error)

FindDatabaseDataByUID ユーザーIDからデータベースのデータを取得する

func (*UserRepository) FindInUID

func (re *UserRepository) FindInUID(ctx context.Context, f *firestore.Client, uid []string) ([]*model.User, error)

FindInUID ユーザーIDリストから取得する

func (*UserRepository) Update

func (re *UserRepository) Update(ctx context.Context, f *firestore.Client, u *model.User) error

Update ユーザーを更新する

func (*UserRepository) UpdateFirebaseUID

func (re *UserRepository) UpdateFirebaseUID(ctx context.Context, f *firestore.Client, user *User) error

UpdateFirebaseUID ユーザーFirebaseUIを更新する

type UserRepositoryInterface

type UserRepositoryInterface interface {
	Create(ctx context.Context, f *firestore.Client, u *model.User) error
	Update(ctx context.Context, f *firestore.Client, u *model.User) error
	UpdateFirebaseUID(ctx context.Context, f *firestore.Client, user *User) error
	Delete(ctx context.Context, f *firestore.Client, tx *firestore.Transaction, uid string) error
	FindByUID(ctx context.Context, f *firestore.Client, uid string) (*model.User, error)
	FindDatabaseDataByUID(ctx context.Context, f *firestore.Client, uid string) (*User, error)
	FindByFirebaseUID(ctx context.Context, f *firestore.Client, fUID string) (*model.User, error)
	ExistByFirebaseUID(ctx context.Context, f *firestore.Client, fUID string) (bool, error)
	FindInUID(ctx context.Context, f *firestore.Client, uid []string) ([]*model.User, error)
}

func NewUserRepository

func NewUserRepository() UserRepositoryInterface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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