object_model

package
v0.0.0-...-ed063ce Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2021 License: MIT Imports: 1 Imported by: 1

README

Object Model

Delinkcious is built using modern software engineering best practices. The core logic and data management is implemented using Go libraries that exposes interfaces and POGOs (plain old Go objects). The shared object_model package defines all these interfaces and data types.

Documentation

Index

Constants

View Source
const (
	LinkStatusPending = "pending"
	LinkStatusValid   = "valid"
	LinkStatusInvalid = "invalid"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AddLinkRequest

type AddLinkRequest struct {
	Url         string
	Title       string
	Description string
	Username    string
	Tags        map[string]bool
}

AddLinkRequest 添加链接请求结构体

type CheckLinkRequest

type CheckLinkRequest struct {
	Username string
	Url      string
}

CheckLinkRequest 检查链接请求结构体

type GetLinksRequest

type GetLinksRequest struct {
	UrlRegex         string
	TitleRegex       string
	DescriptionRegex string
	Username         string
	Tag              string
	StartToken       string
}

GetLinksRequest 获取链接请求结构体

type GetLinksResult

type GetLinksResult struct {
	Links         []Link
	NextPageToken string
}

GetLinksResult 获取链接响应结构体

type GetNewsRequest

type GetNewsRequest struct {
	Username   string
	StartToken string
}

GetNewsRequest 获取新闻请求结构体

type GetNewsResult

type GetNewsResult struct {
	Events    []*LinkManagerEvent
	NextToken string
}

GetNewsResult 获取新闻响应结构体

type Link struct {
	Url         string
	Title       string
	Description string
	Status      LinkStatus
	Tags        map[string]bool
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

Link 链接结构体

type LinkCheckerEvents

type LinkCheckerEvents interface {
	OnLinkChecked(username string, url string, status LinkStatus)
}

LinkCheckerEvents 链接检查回调

type LinkManager

type LinkManager interface {
	GetLinks(request GetLinksRequest) (GetLinksResult, error)
	AddLink(request AddLinkRequest) error
	UpdateLink(request UpdateLinkRequest) error
	DeleteLink(username string, url string) error
}

LinkManager 链接管理接口

type LinkManagerEvent

type LinkManagerEvent struct {
	EventType LinkManagerEventTypeEnum
	Username  string
	Url       string
	Timestamp time.Time
}

LinkManagerEvent 链接管理回调结构体

type LinkManagerEventTypeEnum

type LinkManagerEventTypeEnum int

LinkManagerEventTypeEnum 链接管理回调枚举类型 定义新类型

const (
	LinkAdded LinkManagerEventTypeEnum = iota
	LinkUpdated
	LinkDeleted
)

type LinkManagerEvents

type LinkManagerEvents interface {
	OnLinkAdded(username string, link *Link)
	OnLinkUpdated(username string, link *Link)
	OnLinkDeleted(username string, url string)
}

LinkManagerEvents 链接管理回调

type LinkStatus

type LinkStatus = string

LinkStatus 链接别名

type NewsManager

type NewsManager interface {
	GetNews(request GetNewsRequest) (GetNewsResult, error)
}

NewsManager 新闻管理接口

type SocialGraphManager

type SocialGraphManager interface {
	Follow(followed string, follower string) error
	Unfollow(followed string, follower string) error

	GetFollowing(username string) (map[string]bool, error)
	GetFollowers(username string) (map[string]bool, error)
}

SocialGraphManager 社交图谱管理接口

type UpdateLinkRequest

type UpdateLinkRequest struct {
	Url         string
	Title       string
	Description string
	Username    string
	AddTags     map[string]bool
	RemoveTags  map[string]bool
}

UpdateLinkRequest 修改链接请求结构体

type User

type User struct {
	Email string
	Name  string
}

User 用户结构体

type UserManager

type UserManager interface {
	Register(user User) error
	Login(username string, authToken string) (session string, err error)
	Logout(username string, session string) error
}

UserManager 用户管理接口

Jump to

Keyboard shortcuts

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