database

package
v0.0.0-...-0e27891 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorEnvVar = fmt.Errorf("missing environment variable")

ErrorEnvVar : Environment variable error

Functions

This section is empty.

Types

type MockTextChat

type MockTextChat struct {
}

func (*MockTextChat) AddConversation

func (mp *MockTextChat) AddConversation(ctx context.Context, conversation *data.Conversation) (*data.Conversation, error)

func (*MockTextChat) AddMessage

func (mp *MockTextChat) AddMessage(ctx context.Context, message *data.Message) error

func (*MockTextChat) AddUserToConversation

func (mp *MockTextChat) AddUserToConversation(ctx context.Context, conversation *data.Conversation) error

func (*MockTextChat) CloseDB

func (mp *MockTextChat) CloseDB()

func (*MockTextChat) Connect

func (mp *MockTextChat) Connect() error

func (*MockTextChat) DeleteConversation

func (mp *MockTextChat) DeleteConversation(ctx context.Context, id string) error

func (*MockTextChat) DeleteMessage

func (mp *MockTextChat) DeleteMessage(ctx context.Context, id string) error

func (*MockTextChat) GetConversationByID

func (mp *MockTextChat) GetConversationByID(ctx context.Context, id string) (*data.Conversation, error)

func (*MockTextChat) GetMessageByID

func (mp *MockTextChat) GetMessageByID(ctx context.Context, id string) (*data.Message, error)

func (*MockTextChat) GetMessagesByConversationID

func (mp *MockTextChat) GetMessagesByConversationID(ctx context.Context, id string) (data.Messages, error)

func (*MockTextChat) PingDB

func (mp *MockTextChat) PingDB() error

type MongoTextChat

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

func (*MongoTextChat) AddConversation

func (mp *MongoTextChat) AddConversation(ctx context.Context, conversation *data.Conversation) (*data.Conversation, error)

func (*MongoTextChat) AddMessage

func (mp *MongoTextChat) AddMessage(ctx context.Context, message *data.Message) error

func (*MongoTextChat) AddUserToConversation

func (mp *MongoTextChat) AddUserToConversation(ctx context.Context, conversation *data.Conversation) error

func (*MongoTextChat) CloseDB

func (mp *MongoTextChat) CloseDB()

func (*MongoTextChat) Connect

func (mp *MongoTextChat) Connect() error

func (*MongoTextChat) DeleteConversation

func (mp *MongoTextChat) DeleteConversation(ctx context.Context, id string) error

func (*MongoTextChat) DeleteMessage

func (mp *MongoTextChat) DeleteMessage(ctx context.Context, id string) error

func (*MongoTextChat) GetConversationByID

func (mp *MongoTextChat) GetConversationByID(ctx context.Context, id string) (*data.Conversation, error)

func (*MongoTextChat) GetMessageByID

func (mp *MongoTextChat) GetMessageByID(ctx context.Context, id string) (*data.Message, error)

func (*MongoTextChat) GetMessagesByConversationID

func (mp *MongoTextChat) GetMessagesByConversationID(ctx context.Context, id string) (data.Messages, error)

func (*MongoTextChat) PingDB

func (mp *MongoTextChat) PingDB() error

type TextChatDB

type TextChatDB interface {
	GetMessageByID(ctx context.Context, id string) (*data.Message, error)
	GetConversationByID(ctx context.Context, id string) (*data.Conversation, error)
	GetMessagesByConversationID(ctx context.Context, id string) (data.Messages, error)
	AddMessage(ctx context.Context, message *data.Message) error
	AddConversation(ctx context.Context, conversation *data.Conversation) (*data.Conversation, error)
	AddUserToConversation(ctx context.Context, conversation *data.Conversation) error
	DeleteMessage(ctx context.Context, id string) error
	DeleteConversation(ctx context.Context, id string) error
	Connect() error
	PingDB() error
	CloseDB()
}

The interface that any kind of database must implement

func NewMockTextChat

func NewMockTextChat() TextChatDB

func NewMongoTextChat

func NewMongoTextChat() TextChatDB

Jump to

Keyboard shortcuts

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