pages

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CacheDeserialize

func CacheDeserialize(data []byte, target interface{}) error

CacheDeserialize is used to deserialize data retrieved from cache

func CacheSerialize

func CacheSerialize(data interface{}) ([]byte, error)

CacheSerialize is used to serialize data which is to be stored in the cache

func Random

func Random(n int) string

Random returns a random string of length n

func RandomNumeric

func RandomNumeric(n int) string

RandomNumeric returns a random number in string format, with n digits

func RandomUniqueUniversal

func RandomUniqueUniversal() string

RandomUniqueUniversal returns a universally unique random string (UUID)

Types

type Config

type Config struct {
	Host      string
	Port      string
	StoreName string
	Password  string
	PoolSize  int

	IdleTimeoutSecs  time.Duration
	ReadTimeoutSecs  time.Duration
	WriteTimeoutSecs time.Duration
	DialTimeoutSecs  time.Duration
}

type Page

type Page struct {
	ID        string    `json:"id,omitempty"`
	Content   string    `json:"content,omitempty"`
	CreatedAt time.Time `json:"createdAt,omitempty"`
	Expiry    time.Time `json:"expiry,omitempty"`
}

func (*Page) Sanitize

func (p *Page) Sanitize()

func (*Page) URL

func (p *Page) URL(baseURL string) string

func (*Page) Validate

func (p *Page) Validate() error

type Pages

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

func NewService

func NewService(cfg *Config) (*Pages, error)

func (*Pages) Active added in v0.4.1

func (ps *Pages) Active(ctx context.Context) (int, error)

func (*Pages) Create

func (ps *Pages) Create(ctx context.Context, pg *Page) (*Page, error)

func (*Pages) Read

func (ps *Pages) Read(ctx context.Context, pageID string) (*Page, error)

type RedisDriver

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

RedisDriver has all the dependencies required to initialize redigo & exposes all the methods provided by redigo

func (*RedisDriver) Conn

func (rd *RedisDriver) Conn(ctx context.Context) (redis.Conn, error)

Conn returns a new redis.Conn

Jump to

Keyboard shortcuts

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