social

package
v0.0.0-...-872e689 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const HOME_TIME_LINE_LIMIT = 1000

Variables

This section is empty.

Functions

This section is empty.

Types

type Social

type Social struct {
	Client *redis.Client
}

func NewSocial

func NewSocial() *Social

user:$UserId ----- hset // User Info

login:      user.Login,
id:         user.Id,
name:       user.Name,
followers:  user.Followers,
followings: user.Followings,
posts:      user.Posts,
signup:     user.SignUp,

user:id: ------ int // user唯一ID users: hash ------ login -> id status:$statusId ---- status

message:
posted:
id:
uid:
login:

status:id: ---- int // status唯一ID

home:timeline: ----- zset

$statusId    $posted

user:timeline:$uid ----- zset

$statusId    $posted

followers:$uid ----- zset

$uid1   $time

following:$uid ----- zset

$uid1   $time

home:$uid ------ zset

$statusId   $posted

func (*Social) FollowUser

func (social *Social) FollowUser(fromId, toId string) error

func (*Social) HomeTimeLine

func (social *Social) HomeTimeLine(size int64, offset int64) []*Status

HomeTimeLine: 主页的timeline

func (*Social) NewStatus

func (social *Social) NewStatus(uid string, message string) error

func (*Social) NewUser

func (social *Social) NewUser(login string, name string) (string, error)

func (*Social) ProfileTimeline

func (social *Social) ProfileTimeline(uid string, size int64, offset int64) []*Status

func (*Social) UnFollowUser

func (social *Social) UnFollowUser(fromId, toId string) error

type Status

type Status struct {
	Message string
	Posted  int
	Id      string
	UID     string
	Login   string
}

func (*Status) MTo

func (status *Status) MTo(m map[string]string) error

func (*Status) ToM

func (status *Status) ToM() map[string]interface{}

type User

type User struct {
	Login      string
	Id         string
	Name       string
	Followers  int64
	Followings int64
	Posts      int64
	SignUp     int64
}

Jump to

Keyboard shortcuts

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