repo

package
v0.0.0-...-e6f7b9e Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

Functions

This section is empty.

Types

type Circle

type Circle struct {
	CircleKey
	GroupID       GroupID
	LastUpdatedAt *time.Time
}

type CircleID

type CircleID = string

type CircleKey

type CircleKey struct {
	ID CircleID
}

type EntityID

type EntityID = string

type GroupID

type GroupID = string

type InsertUserInput

type InsertUserInput struct {
	UserKey
	LanguageCodes []LanguageCode
	UnbannedAt    *time.Time
	CreatedAt     time.Time
}

type InsertUserUserEdgeInput

type InsertUserUserEdgeInput struct {
	UserUserEdgeKey
	FollowedAt   *time.Time
	UnfollowedAt *time.Time
	BlockedAt    *time.Time
	UnblockedAt  *time.Time
}

type Kind

type Kind = int64

type LanguageCode

type LanguageCode = string

type PartialUpdateUserCircleEdgeInput

type PartialUpdateUserCircleEdgeInput struct {
	UserCircleEdgeKey
	JoinedAt *time.Time
	LeftAt   *time.Time
}

type PartialUpdateUserInput

type PartialUpdateUserInput struct {
	UserKey
	LanguageCodes []LanguageCode
	BannedAt      *time.Time
	UnbannedAt    *time.Time
}

type PartialUpdateUserUserEdgeInput

type PartialUpdateUserUserEdgeInput struct {
	UserUserEdgeKey
	FollowedAt   *time.Time
	UnfollowedAt *time.Time
	BlockedAt    *time.Time
	UnblockedAt  *time.Time
}

type Post

type Post struct {
	ID           string
	UserID       string
	CircleID     string
	CreatedAt    time.Time
	Kind         int64
	LanguageCode string
	OwnerID      *string
	OwnerKind    int64
	DeletedAt    *time.Time
}

type PostID

type PostID = string

type ReadActions

type ReadActions interface {
	GetPosts(context.Context, ...PostID) ([]Post, error)
	GetSearches(context.Context, Kind, UserID, cursor.Cursor) ([]Search, error)
	// GetUserUserEdge returns the edge from userID to targetUserID if it exists and ErrNotFound otherwise.
	GetUserUserEdge(context.Context, UserUserEdgeKey) (UserUserEdge, error)
	// GetCircle returns the circle with the given circleID if it exists and ErrNotFound otherwise.
	GetCircle(context.Context, CircleKey) (Circle, error)
	// GetUserCircleEdge returns the edge from userID to circleID if it exists and ErrNotFound otherwise.
	GetUserCircleEdge(context.Context, UserCircleEdgeKey) (UserCircleEdge, error)
	// GetUser returns the user with the given userID if it exists and ErrNotFound otherwise.
	GetUser(context.Context, UserKey) (User, error)
	ExistsUser(context.Context, UserKey) (bool, error)
	GetPostClassificationTags(context.Context, PostID) ([]string, error)
}

type ReadWriteActions

type ReadWriteActions interface {
	ReadActions
	WriteActions
}

type Repo

type Repo interface {
	SingleRead() ReadActions
	SingleWrite() WriteActions
	ReadOnlyTx(context.Context, func(ctx context.Context, tx ReadActions) error) error
	ReadWriteTx(context.Context, func(ctx context.Context, tx ReadWriteActions) error) (time.Time, error)
}
type Search struct {
	SearchKey
	CreatedAt time.Time
}

type SearchInput

type SearchInput struct {
	SearchKey
}

type SearchKey

type SearchKey struct {
	Kind     Kind
	UserID   UserID
	EntityID EntityID
}

type User

type User struct {
	UserKey
	LanguageCodes []LanguageCode
	IsBanned      bool
	BannedAt      *time.Time
	UnbannedAt    *time.Time
	CreatedAt     time.Time
}

type UserCircleEdge

type UserCircleEdge struct {
	UserCircleEdgeKey
	IsMember  bool
	JoinedAt  *time.Time
	LeftAt    *time.Time
	CreatedAt time.Time
}

type UserCircleEdgeKey

type UserCircleEdgeKey struct {
	UserID   UserID
	CircleID CircleID
}

type UserID

type UserID = string

type UserKey

type UserKey struct {
	UserID UserID
}

type UserUserEdge

type UserUserEdge struct {
	UserUserEdgeKey
	FollowedAt   *time.Time
	UnfollowedAt *time.Time
	IsFollowing  bool
	BlockedAt    *time.Time
	UnblockedAt  *time.Time
	IsBlocking   bool
}

type UserUserEdgeKey

type UserUserEdgeKey struct {
	UserID       UserID
	TargetUserID UserID
}

type WriteActions

type WriteActions interface {
	UpsertSearch(context.Context, SearchInput) error
	DeleteSearch(context.Context, SearchKey) error

	InsertUserUserEdge(context.Context, InsertUserUserEdgeInput) error
	PartialUpdateUserUserEdge(context.Context, PartialUpdateUserUserEdgeInput) error

	UpsertCircle(context.Context, Circle) error
	DeleteCircle(context.Context, CircleKey) error

	InsertUserCircleEdge(context.Context, UserCircleEdge) error
	PartialUpdateUserCircleEdge(context.Context, PartialUpdateUserCircleEdgeInput) error

	InsertUser(context.Context, InsertUserInput) error
	PartialUpdateUser(context.Context, PartialUpdateUserInput) error

	InsertPosts(context.Context, ...Post) error
	RemovePost(ctx context.Context, postID string, deletedAt time.Time) error

	UpsertPostClassificationTags(ctx context.Context, postID string, tags ...string) error
}

Directories

Path Synopsis
tables
Code generated by tablegen.
Code generated by tablegen.

Jump to

Keyboard shortcuts

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