repo

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2020 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppleWhereAndOrderFunc

type AppleWhereAndOrderFunc func(q *orm.Query, isAfter bool, cursor string) (*orm.Query, error)

type DealSliceResultFunc

type DealSliceResultFunc func(i int, isFirst bool, isLast bool)

type ForumRepo

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

func (*ForumRepo) GetAnonyID

func (f *ForumRepo) GetAnonyID(ctx context.Context, userID uid.UID, threadID uid.UID) (string, error)

func (*ForumRepo) GetMainTags

func (f *ForumRepo) GetMainTags(ctx context.Context) ([]string, error)

func (*ForumRepo) GetPost

func (f *ForumRepo) GetPost(ctx context.Context, search *entity.PostSearch) (*entity.Post, error)

func (*ForumRepo) GetPostCount

func (f *ForumRepo) GetPostCount(ctx context.Context, search *entity.PostsSearch) (int, error)

func (*ForumRepo) GetPostQuotedCount

func (f *ForumRepo) GetPostQuotedCount(ctx context.Context, id uid.UID) (int, error)

func (*ForumRepo) GetPostSlice

func (f *ForumRepo) GetPostSlice(
	ctx context.Context, search *entity.PostsSearch, query entity.SliceQuery,
) (*entity.PostSlice, error)

func (*ForumRepo) GetPosts

func (f *ForumRepo) GetPosts(ctx context.Context, search *entity.PostsSearch) ([]*entity.Post, error)

func (*ForumRepo) GetTags

func (f *ForumRepo) GetTags(ctx context.Context, search *entity.TagSearch) ([]*entity.Tag, error)

func (*ForumRepo) GetThread

func (f *ForumRepo) GetThread(ctx context.Context, search *entity.ThreadSearch) (*entity.Thread, error)

func (*ForumRepo) GetThreadCatalog

func (f *ForumRepo) GetThreadCatalog(ctx context.Context, id uid.UID) ([]*entity.ThreadCatalogItem, error)

func (*ForumRepo) GetThreadSlice

func (f *ForumRepo) GetThreadSlice(
	ctx context.Context, search *entity.ThreadsSearch, query entity.SliceQuery,
) (*entity.ThreadSlice, error)

func (*ForumRepo) InsertPost

func (f *ForumRepo) InsertPost(ctx context.Context, post *entity.Post) error

func (*ForumRepo) InsertThread

func (f *ForumRepo) InsertThread(ctx context.Context, thread *entity.Thread) error

func (*ForumRepo) SetMainTags

func (f *ForumRepo) SetMainTags(ctx context.Context, tags []string) error

func (*ForumRepo) UpdatePost

func (f *ForumRepo) UpdatePost(ctx context.Context, id uid.UID, update *entity.PostUpdate) error

func (*ForumRepo) UpdateThread

func (f *ForumRepo) UpdateThread(ctx context.Context, id uid.UID, update *entity.ThreadUpdate) error

type NotiRepo

type NotiRepo struct{}

func (*NotiRepo) GetNotiByKey

func (n *NotiRepo) GetNotiByKey(ctx context.Context, userID uid.UID, key string) (*entity.Notification, error)

func (*NotiRepo) GetNotiSlice

func (n *NotiRepo) GetNotiSlice(
	ctx context.Context, user *entity.User, query entity.SliceQuery,
) (*entity.NotiSlice, error)

func (*NotiRepo) GetUserUnreadCount

func (n *NotiRepo) GetUserUnreadCount(ctx context.Context, user *entity.User) (int, error)

func (*NotiRepo) InsertNoti

func (n *NotiRepo) InsertNoti(ctx context.Context, noti *entity.Notification) error

func (*NotiRepo) ToEntityNoti

func (n *NotiRepo) ToEntityNoti(noti *NotificationQuery) *entity.Notification

func (*NotiRepo) UpdateNotiContent

func (n *NotiRepo) UpdateNotiContent(ctx context.Context, noti *entity.Notification) error

func (*NotiRepo) UpdateReadID

func (n *NotiRepo) UpdateReadID(ctx context.Context, userID uid.UID, id uid.UID) error

type Notification

type Notification struct {
	Key       string                 `pg:"key,pk"`
	SortKey   uid.UID                `pg:"sort_key"`
	CreatedAt time.Time              `pg:"created_at"`
	UpdatedAt time.Time              `pg:"updated_at"`
	Type      entity.NotiType        `pg:"type,use_zero"`
	Receivers []entity.Receiver      `pg:"receivers,array"`
	Content   map[string]interface{} `pg:"content,json_use_number"`
	// contains filtered or unexported fields
}

type NotificationQuery

type NotificationQuery struct {
	Notification `pg:",inherit"`

	HasRead bool `pg:"has_read"`
}

type Post

type Post struct {
	ID        uid.UID   `pg:"id,pk"`
	CreatedAt time.Time `pg:"created_at"`
	UpdatedAt time.Time `pg:"updated_at"`
	ThreadID  uid.UID   `pg:"thread_id,use_zero"`
	UserID    uid.UID   `pg:"user_id,use_zero"`
	Anonymous bool      `pg:"anonymous,use_zero"`
	Guest     bool      `pg:"guest,use_zero"`
	Author    string    `pg:"author"`
	Blocked   *bool     `pg:"blocked"`
	Content   string    `pg:"content,use_zero"`
	QuotedIDs []uid.UID `pg:"quoted_ids,array"`
	// contains filtered or unexported fields
}

type Tag

type Tag struct {
	Name      string    `pg:"name,pk"`
	CreatedAt time.Time `pg:"created_at"`
	UpdatedAt time.Time `pg:"updated_at"`
	TagType   *string   `pg:"type"`
	// contains filtered or unexported fields
}

type Thread

type Thread struct {
	ID         uid.UID   `pg:"id,pk"`
	LastPostID uid.UID   `pg:"last_post_id,use_zero"`
	CreatedAt  time.Time `pg:"created_at"`
	UpdatedAt  time.Time `pg:"updated_at"`
	UserID     uid.UID   `pg:"user_id,use_zero"`
	Anonymous  bool      `pg:"anonymous,use_zero"`
	Guest      bool      `pg:"guest,use_zero"`
	Author     string    `pg:"author"`
	Title      *string   `pg:"title"`
	Content    string    `pg:"content,use_zero"`
	Locked     bool      `pg:"locked,use_zero"`
	Blocked    bool      `pg:"blocked,use_zero"`
	Tags       []string  `pg:"tags,array"`
	// contains filtered or unexported fields
}

type User

type User struct {
	ID           uid.UID     `pg:"id,pk" json:"id"`
	CreatedAt    time.Time   `pg:"created_at" json:"created_at"`
	UpdatedAt    time.Time   `pg:"updated_at" json:"-"`
	Email        *string     `pg:"email,use_zero" json:"-"`
	Name         *string     `pg:"name" json:"-"`
	Role         entity.Role `pg:"role,use_zero" json:"role"`
	LastReadNoti uid.UID     `pg:"last_read_noti,use_zero" json:"-"`
	Tags         []string    `pg:"tags,array" json:"tags"`
	// contains filtered or unexported fields
}

type UserRepo

type UserRepo struct {
	Redis *redis.Client
	Forum *ForumRepo
}

func (*UserRepo) DelCode

func (u *UserRepo) DelCode(ctx context.Context, code string) error

func (*UserRepo) GetCodeEmail

func (u *UserRepo) GetCodeEmail(ctx context.Context, code string) (string, error)

func (*UserRepo) GetToken

func (u *UserRepo) GetToken(ctx context.Context, tok string) (*entity.Token, error)

func (*UserRepo) GetUserByAuthInfo

func (u *UserRepo) GetUserByAuthInfo(ctx context.Context, ai entity.AuthInfo) (*entity.User, error)

func (*UserRepo) InsertUser

func (u *UserRepo) InsertUser(ctx context.Context, user *entity.User, ex time.Duration) (*entity.User, error)

func (*UserRepo) SetCode

func (u *UserRepo) SetCode(ctx context.Context, email string, code string, ex time.Duration) error

func (*UserRepo) SetToken

func (u *UserRepo) SetToken(ctx context.Context, token *entity.Token) error

func (*UserRepo) UpdateUser

func (u *UserRepo) UpdateUser(ctx context.Context, id uid.UID, update *entity.UserUpdate) error

Directories

Path Synopsis
nolint
nolint

Jump to

Keyboard shortcuts

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