repo

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2023 License: GPL-3.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotImplemented = errors.New("not implemented")
View Source
var ErrNotSupported = errors.New("not supported")

Functions

This section is empty.

Types

type ChatRepo

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

func (ChatRepo) Add

func (c ChatRepo) Add(chat entity.ChatInfo) error

func (ChatRepo) Get

func (c ChatRepo) Get() (entity.ChatInfo, error)

func (ChatRepo) GetAll

func (c ChatRepo) GetAll(opt IOption) ([]entity.ChatInfo, error)

func (ChatRepo) GetByID

func (c ChatRepo) GetByID(id entity.ID) (entity.ChatInfo, error)

func (ChatRepo) Put added in v0.2.0

func (c ChatRepo) Put(chat entity.ChatInfo) error

type ContactRepo

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

func (ContactRepo) Add

func (c ContactRepo) Add(con entity.Contact) error

func (ContactRepo) Get

func (c ContactRepo) Get() (entity.Contact, error)

func (ContactRepo) GetAll

func (c ContactRepo) GetAll(opt IOption) ([]entity.Contact, error)

func (ContactRepo) GetByID

func (c ContactRepo) GetByID(id entity.ID) (entity.Contact, error)

func (ContactRepo) Put added in v0.2.0

func (c ContactRepo) Put(con entity.Contact) error

type Filter added in v0.1.0

type Filter map[string]interface{}

type IOption added in v0.1.0

type IOption interface {
	Skip() int
	Limit() int
	AddFilter(field string, value interface{})
	Filters() Filter
}

func NewOption added in v0.1.0

func NewOption(skip int, limit int) IOption

type IRepo

type IRepo[C any] interface {
	Get() (C, error)
	GetByID(id entity.ID) (C, error)
	GetAll(opt IOption) ([]C, error)
	Put(C) error
	Add(C) error
}

TODO: after adding IOption look like we can remove GetAll and GetByID

func NewChatRepo

func NewChatRepo(store *store.Store) IRepo[entity.ChatInfo]

func NewContactRepo

func NewContactRepo(store *store.Store) IRepo[entity.Contact]

func NewIdentityRepo

func NewIdentityRepo(store *store.Store) IRepo[entity.Identity]

func NewMessageRepo

func NewMessageRepo(store *store.Store) IRepo[entity.Message]

type IdentityRepo

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

func (IdentityRepo) Add

func (i IdentityRepo) Add(con entity.Identity) error

func (IdentityRepo) Get

func (i IdentityRepo) Get() (entity.Identity, error)

func (IdentityRepo) GetAll

func (i IdentityRepo) GetAll(_ IOption) ([]entity.Identity, error)

func (IdentityRepo) GetByID

func (i IdentityRepo) GetByID(id entity.ID) (entity.Identity, error)

func (IdentityRepo) Put added in v0.2.0

func (i IdentityRepo) Put(iden entity.Identity) error

type MessageRepo

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

func (MessageRepo) Add

func (m MessageRepo) Add(msg entity.Message) error

func (MessageRepo) Get

func (m MessageRepo) Get() (entity.Message, error)

func (MessageRepo) GetAll

func (m MessageRepo) GetAll(opt IOption) ([]entity.Message, error)

func (MessageRepo) GetByID

func (m MessageRepo) GetByID(id entity.ID) (entity.Message, error)

func (MessageRepo) Put added in v0.2.0

func (m MessageRepo) Put(msg entity.Message) error

type Option added in v0.1.0

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

func (Option) AddFilter added in v0.1.0

func (o Option) AddFilter(n string, s interface{})

func (Option) Filters added in v0.1.0

func (o Option) Filters() Filter

func (Option) Limit added in v0.1.0

func (o Option) Limit() int

func (Option) Skip added in v0.1.0

func (o Option) Skip() int

Jump to

Keyboard shortcuts

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