Documentation ¶
Index ¶
- Constants
- Variables
- func CacheKeyBlog(id int) string
- func CacheKeyBlogs(limit, offset int) string
- func CacheKeyBlogsByUserId(id int) string
- func CacheKeyLikeCount(blogID int) string
- func CacheKeyLikedUsers(blogID int) string
- func CacheKeyUserByAccessToken(token []byte) string
- func CacheKeyUserByUsername(username string) string
- func CloseDB(db *sql.DB) error
- func ForeignKeyError(err error, name string) bool
- func NewDB(host, user, password, name string, maxOpenConns, maxIdleConns int, ...) (*sql.DB, error)
- func SetupUserExchange(mb *MessageBroker) error
- func TestDB(filepath string, t *testing.T) *sql.DB
- func TestRabbitMQ(t *testing.T) string
- type BindingKey
- type Cache
- type Exchange
- type MessageBroker
- type MessageConsumer
- type MessageProducer
- type Queue
- type ValidationError
- type Validator
Constants ¶
View Source
const ( UserExchange Exchange = "user_exchange" UserCreatedQueue Queue = "user_created_queue" UserCreatedKey BindingKey = "user.created" )
Variables ¶
View Source
var (
ErrRecordNotFound = fmt.Errorf("record not found")
)
Functions ¶
func CacheKeyBlog ¶
func CacheKeyBlogs ¶
func CacheKeyBlogsByUserId ¶
func CacheKeyLikeCount ¶
func CacheKeyLikedUsers ¶
func CacheKeyUserByUsername ¶
func ForeignKeyError ¶
func SetupUserExchange ¶
func SetupUserExchange(mb *MessageBroker) error
func TestRabbitMQ ¶
Types ¶
type BindingKey ¶
type BindingKey string
type MessageBroker ¶
type MessageBroker struct {
// contains filtered or unexported fields
}
func NewMessageBroker ¶
func NewMessageBroker(URI string) (*MessageBroker, error)
func (*MessageBroker) Close ¶
func (mb *MessageBroker) Close() error
Close closes the connection and channel of the message broker.
func (*MessageBroker) Consume ¶
func (mb *MessageBroker) Consume(key BindingKey, exchange Exchange, queue Queue) (<-chan amqp.Delivery, error)
func (*MessageBroker) Publish ¶
func (mb *MessageBroker) Publish(ctx context.Context, msg []byte, key BindingKey, exchange Exchange) error
type MessageConsumer ¶
type MessageProducer ¶
type ValidationError ¶
func (ValidationError) Error ¶
func (e ValidationError) Error() string
type Validator ¶
func NewValidator ¶
func NewValidator() *Validator
func (*Validator) CheckStringLength ¶
func (*Validator) ValidationError ¶
Click to show internal directories.
Click to hide internal directories.