dao

package
v0.0.0-...-b79fb73 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Db

type Db interface {
	Init(data interface{}) error
	One(fieldName string, value interface{}, to interface{}) error
	Update(data interface{}) error
	Save(data interface{}) error
	DeleteStruct(data interface{}) error
	Select(matchers ...q.Matcher) storm.Query
	Find(fieldName string, value interface{}, to interface{}, options ...func(q *index.Options)) error
	All(to interface{}, options ...func(*index.Options)) error
	Close() error
}

func GetClient

func GetClient(dbFilePath string) (Db, error)

type MessageDao

type MessageDao interface {
	//Create creates message record and returns its id
	Create(text, sender string) (uint32, error)
	//GetOneById returns message by id
	GetOneById(id uint32) (model.Message, error)
	//GetAll returns all messages
	GetAll() ([]model.Message, error)
	//RemoveOlderThanDays removes all messages older than {days}
	RemoveOlderThanDays(days int) error
}

func NewMessageDao

func NewMessageDao(db Db) MessageDao

type RecipientDao

type RecipientDao interface {
	//Create creates recipient record and returns its id
	Create(messageId uint32, phone string) (uint32, error)
	//UpdateSubmitStatus updates status and delivery id of recipient record with the given id
	UpdateSubmitStatus(id uint32, deliverId string, status string) error
	//UpdateDeliverStatus updates status of recipient record with the delivery id
	UpdateDeliverStatus(deliverId string, status string) (uint32, string, error)
	//GetOneByMessageIdAndPhone returns a recipient with the given message id and phone
	GetOneByMessageIdAndPhone(messageId uint32, phone string) (model.Recipient, error)
	//GetAllByMessageId returns all recipients with the given message id
	GetAllByMessageId(messageId uint32) ([]model.Recipient, error)
	//GetAll returns all recipients
	GetAll() ([]model.Recipient, error)
	//RemoveOlderThanDays removes all recipients older that {days}
	RemoveOlderThanDays(days int) error
}

func NewRecipientDao

func NewRecipientDao(db Db) RecipientDao

Jump to

Keyboard shortcuts

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