topic

package
v0.0.0-...-ac0e98d Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package topic provides a core business API.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound   = errors.New("topic not found")
	ErrUniqueName = errors.New("topic already exists")
)

Set of error variables for CRUD operations.

Functions

This section is empty.

Types

type Core

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

Core manages the set of APIs for user access.

func NewCore

func NewCore(log *zerolog.Logger, storer Storer, gen util.Generator) *Core

NewCore constructs a user core API for use.

func (*Core) Create

func (c *Core) Create(nt NewTopic) (Topic, error)

Create adds a new user to the system.

func (*Core) Query

func (c *Core) Query(pageNumber int, rowsPerPage int) ([]Topic, error)

Query retrieves a list of existing topics.

func (*Core) QueryByID

func (c *Core) QueryByID(id uuid.UUID) (Topic, error)

QueryByID finds the topic by the specified ID.

type NewTopic

type NewTopic struct {
	Name string
}

NewTopic contains information needed to create a new topic.

type Storer

type Storer interface {
	WithinTran(fn func(s Storer) error) error
	Create(topic Topic) error
	Query(pageNumber int, rowsPerPage int) ([]Topic, error)
	QueryByID(id uuid.UUID) (Topic, error)
}

Storer interface declares the behavior this package needs to perists and retrieve data.

type Topic

type Topic struct {
	ID        uuid.UUID
	Name      string
	CreatedAt time.Time
}

Topic represents information about an individual topic.

Directories

Path Synopsis
Package mocktpc is a generated GoMock package.
Package mocktpc is a generated GoMock package.
Package topicdb contains topic related CRUD functionality.
Package topicdb contains topic related CRUD functionality.

Jump to

Keyboard shortcuts

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