postgres

package
v0.0.0-...-e438b56 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConversantRepository

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

func NewConversantRepository

func NewConversantRepository(db *sqlx.DB) *ConversantRepository

func (*ConversantRepository) UpdateOrCreate

func (repo *ConversantRepository) UpdateOrCreate(conversant repositories.Conversant) (*repositories.Conversant, error)

type ConversationRepository

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

ConversationRepository is an implementation of ConversationRepo that uses Postgres as it's backend

func NewConversationRepository

func NewConversationRepository(db *sqlx.DB) *ConversationRepository

NewConversationRepository creates a Postgres instance of a ConversationRepo

func (*ConversationRepository) CreateConversation

func (repo *ConversationRepository) CreateConversation(conversation repositories.Conversation) (*repositories.Conversation, error)

CreateConversation creates a conversation with a postgres transaction. If any of it fails, it rolls back or returns an error

func (*ConversationRepository) GetConversants

func (repo *ConversationRepository) GetConversants(conversationID string) ([]repositories.Conversant, error)

GetConversants gets the conversants for a given conversation

func (*ConversationRepository) RetrieveConversation

func (repo *ConversationRepository) RetrieveConversation(conversationID string, limit, offset int) (*repositories.Conversation, error)

RetrieveConversation grabs a conversation with the messages given a limit and offset

type MessageRepository

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

MessageRepository is a MessageRepo implementation that uses Postgres to store messages

func NewMessageRepository

func NewMessageRepository(db *sqlx.DB) *MessageRepository

NewMessageRepository creates a new Postgres MessageRepository

func (*MessageRepository) CreateMessage

func (repo *MessageRepository) CreateMessage(message repositories.Message) (*repositories.Message, error)

CreateMessage stores a message in Postgres

Jump to

Keyboard shortcuts

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