sqlite3

package
v0.0.0-...-897d125 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RepositoryProducer

func RepositoryProducer(dataSourceName string) (entity.Repositories, error)

Types

type MessageRepository

type MessageRepository struct{}

func (MessageRepository) Add

func (MessageRepository) LatestRoomMessages

func (mr MessageRepository) LatestRoomMessages(ctx context.Context, roomID uint64, n int) ([]entity.Message, error)

func (MessageRepository) PreviousRoomMessages

func (mr MessageRepository) PreviousRoomMessages(ctx context.Context, offset entity.Message, n int) ([]entity.Message, error)

func (MessageRepository) ReadMessage

func (mr MessageRepository) ReadMessage(ctx context.Context, roomID, userID uint64, messageIDs []uint64) error

type Repositories

type Repositories struct {
	DB *sqlx.DB
	*UserRepository
	*MessageRepository
	*RoomRepository
}

func (Repositories) BeginTx

func (r Repositories) BeginTx(ctx context.Context) (entity.Tx, error)

func (Repositories) Close

func (r Repositories) Close() error

func (Repositories) Messages

func (r Repositories) Messages() entity.MessageRepository

func (Repositories) Rooms

func (Repositories) Users

type RoomRepository

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

func (RoomRepository) Add

func (repo RoomRepository) Add(ctx context.Context, r entity.Room) (uint64, error)

func (RoomRepository) Find

func (repo RoomRepository) Find(ctx context.Context, roomID uint64) (entity.Room, error)

func (RoomRepository) GetUserRooms

func (repo RoomRepository) GetUserRooms(ctx context.Context, userID uint64) ([]entity.Room, error)

func (RoomRepository) Remove

func (repo RoomRepository) Remove(ctx context.Context, r entity.Room) error

func (RoomRepository) RoomHasMember

func (repo RoomRepository) RoomHasMember(ctx context.Context, roomID uint64, userID uint64) bool

type UserRepository

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

UserRepository manages access to user table in sqlite database. It must be singleton object since database conncetion is so.

func (*UserRepository) ExistByNameAndPassword

func (repo *UserRepository) ExistByNameAndPassword(name string, password string) bool

func (*UserRepository) Find

func (repo *UserRepository) Find(id uint64) (entity.User, error)

func (*UserRepository) FindByNameAndPassword

func (repo *UserRepository) FindByNameAndPassword(name string, password string) (entity.User, error)

func (*UserRepository) Relation

func (repo *UserRepository) Relation(ctx context.Context, userID uint64) (entity.UserRelation, error)

func (*UserRepository) Save

func (repo *UserRepository) Save(u entity.User) (uint64, error)

Jump to

Keyboard shortcuts

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