datastore

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2017 License: MIT Imports: 21 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TABLE_NAME_API          = utils.Cfg.Datastore.TableNamePrefix + "api"
	TABLE_NAME_USER         = utils.Cfg.Datastore.TableNamePrefix + "user"
	TABLE_NAME_BLOCK_USER   = utils.Cfg.Datastore.TableNamePrefix + "block_user"
	TABLE_NAME_ROOM         = utils.Cfg.Datastore.TableNamePrefix + "room"
	TABLE_NAME_ROOM_USER    = utils.Cfg.Datastore.TableNamePrefix + "room_user"
	TABLE_NAME_MESSAGE      = utils.Cfg.Datastore.TableNamePrefix + "message"
	TABLE_NAME_DEVICE       = utils.Cfg.Datastore.TableNamePrefix + "device"
	TABLE_NAME_SUBSCRIPTION = utils.Cfg.Datastore.TableNamePrefix + "subscription"
)

Functions

func RdbCreateApiStore added in v0.6.0

func RdbCreateApiStore()

func RdbCreateBlockUserStore added in v0.7.0

func RdbCreateBlockUserStore()

func RdbCreateDeviceStore added in v0.2.0

func RdbCreateDeviceStore()

func RdbCreateMessageStore

func RdbCreateMessageStore()

func RdbCreateRoomStore added in v0.2.0

func RdbCreateRoomStore()

func RdbCreateRoomUserStore added in v0.2.0

func RdbCreateRoomUserStore()

func RdbCreateSubscriptionStore added in v0.2.0

func RdbCreateSubscriptionStore()

func RdbCreateUserStore added in v0.2.0

func RdbCreateUserStore()

func RdbStoreInstance added in v0.9.0

func RdbStoreInstance() *rdbStore

Types

type ApiStore added in v0.6.0

type ApiStore interface {
	CreateApiStore()

	InsertApi(name string) StoreResult
	SelectLatestApi(name string) StoreResult
}

type BlockUserStore added in v0.7.0

type BlockUserStore interface {
	CreateBlockUserStore()

	InsertBlockUsers(blockUsers []*models.BlockUser) StoreResult
	SelectBlockUser(userId, blockUserId string) StoreResult
	SelectBlockUsersByUserId(userId string) StoreResult
	DeleteBlockUser(userId string, blockUserIds []string) StoreResult
}

type DeviceStore added in v0.2.0

type DeviceStore interface {
	CreateDeviceStore()

	InsertDevice(device *models.Device) StoreResult
	SelectDevices(userId string) StoreResult
	SelectDevice(userId string, platform int) StoreResult
	SelectDevicesByUserId(userId string) StoreResult
	SelectDevicesByToken(token string) StoreResult
	UpdateDevice(device *models.Device) StoreResult
	DeleteDevice(userId string, platform int) StoreResult
}

type MessageStore

type MessageStore interface {
	CreateMessageStore()

	InsertMessage(message *models.Message) StoreResult
	SelectMessage(messageId string) StoreResult
	SelectMessages(roomId string, limit, offset int, order string) StoreResult
	SelectCountMessagesByRoomId(roomId string) StoreResult
	UpdateMessage(message *models.Message) StoreResult
}

type Provider

type Provider interface {
	Connect() error
	Init()
	DropDatabase() error
	ApiStore
	UserStore
	BlockUserStore
	RoomStore
	RoomUserStore
	MessageStore
	DeviceStore
	SubscriptionStore
}

func GetProvider

func GetProvider() Provider

type RoomStore

type RoomStore interface {
	CreateRoomStore()

	InsertRoom(room *models.Room) StoreResult
	SelectRoom(roomId string) StoreResult
	SelectRooms() StoreResult
	SelectUsersForRoom(roomId string) StoreResult
	SelectCountRooms() StoreResult
	UpdateRoom(room *models.Room) StoreResult
	UpdateRoomDeleted(roomId string) StoreResult
}

type RoomUserStore

type RoomUserStore interface {
	CreateRoomUserStore()

	DeleteAndInsertRoomUsers(roomUsers []*models.RoomUser) StoreResult
	InsertRoomUsers(roomUsers []*models.RoomUser) StoreResult
	SelectRoomUser(roomId, userId string) StoreResult
	SelectRoomUserOfOneOnOne(myUserId, opponentUserId string) StoreResult
	SelectRoomUsersByRoomId(roomId string) StoreResult
	SelectRoomUsersByUserId(userId string) StoreResult
	SelectRoomUsersByRoomIdAndUserIds(roomId *string, userIds []string) StoreResult
	UpdateRoomUser(*models.RoomUser) StoreResult
	DeleteRoomUser(roomId string, userIds []string) StoreResult
}

type StoreChannel

type StoreChannel chan StoreResult

type StoreResult

type StoreResult struct {
	Data          interface{}
	ProblemDetail *models.ProblemDetail
}

func RdbDeleteAndInsertRoomUsers added in v0.2.0

func RdbDeleteAndInsertRoomUsers(roomUsers []*models.RoomUser) StoreResult

func RdbDeleteBlockUser added in v0.7.0

func RdbDeleteBlockUser(userId string, blockUserIds []string) StoreResult

func RdbDeleteDevice added in v0.2.0

func RdbDeleteDevice(userId string, platform int) StoreResult

func RdbDeleteRoomUser added in v0.2.0

func RdbDeleteRoomUser(roomId string, userIds []string) StoreResult

func RdbDeleteSubscription added in v0.2.0

func RdbDeleteSubscription(subscription *models.Subscription) StoreResult

func RdbInsertApi added in v0.6.0

func RdbInsertApi(name string) StoreResult

func RdbInsertBlockUsers added in v0.7.0

func RdbInsertBlockUsers(blockUsers []*models.BlockUser) StoreResult

func RdbInsertDevice added in v0.2.0

func RdbInsertDevice(device *models.Device) StoreResult

func RdbInsertMessage added in v0.2.0

func RdbInsertMessage(message *models.Message) StoreResult

func RdbInsertRoom added in v0.2.0

func RdbInsertRoom(room *models.Room) StoreResult

func RdbInsertRoomUsers added in v0.2.0

func RdbInsertRoomUsers(roomUsers []*models.RoomUser) StoreResult

func RdbInsertSubscription added in v0.2.0

func RdbInsertSubscription(subscription *models.Subscription) StoreResult

func RdbInsertUser added in v0.2.0

func RdbInsertUser(user *models.User) StoreResult

func RdbSelectBlockUser added in v0.7.0

func RdbSelectBlockUser(userId, blockUserId string) StoreResult

func RdbSelectBlockUsersByUserId added in v0.7.0

func RdbSelectBlockUsersByUserId(userId string) StoreResult

func RdbSelectContacts added in v0.7.0

func RdbSelectContacts(userId string) StoreResult

func RdbSelectCountMessagesByRoomId added in v0.2.0

func RdbSelectCountMessagesByRoomId(roomId string) StoreResult

func RdbSelectCountRooms added in v0.2.0

func RdbSelectCountRooms() StoreResult

func RdbSelectDeletedSubscriptionsByRoomId added in v0.7.1

func RdbSelectDeletedSubscriptionsByRoomId(roomId string) StoreResult

func RdbSelectDeletedSubscriptionsByUserId added in v0.7.1

func RdbSelectDeletedSubscriptionsByUserId(userId string) StoreResult

func RdbSelectDeletedSubscriptionsByUserIdAndPlatform added in v0.7.1

func RdbSelectDeletedSubscriptionsByUserIdAndPlatform(userId string, platform int) StoreResult

func RdbSelectDevice added in v0.2.0

func RdbSelectDevice(userId string, platform int) StoreResult

func RdbSelectDevices added in v0.2.0

func RdbSelectDevices(userId string) StoreResult

func RdbSelectDevicesByToken added in v0.7.1

func RdbSelectDevicesByToken(token string) StoreResult

func RdbSelectDevicesByUserId added in v0.2.0

func RdbSelectDevicesByUserId(userId string) StoreResult

func RdbSelectLatestApi added in v0.6.0

func RdbSelectLatestApi(name string) StoreResult

func RdbSelectMessage added in v0.2.0

func RdbSelectMessage(messageId string) StoreResult

func RdbSelectMessages added in v0.2.0

func RdbSelectMessages(roomId string, limit, offset int, order string) StoreResult

func RdbSelectRoom added in v0.2.0

func RdbSelectRoom(roomId string) StoreResult

func RdbSelectRoomUser added in v0.2.0

func RdbSelectRoomUser(roomId, userId string) StoreResult

func RdbSelectRoomUserOfOneOnOne added in v0.8.0

func RdbSelectRoomUserOfOneOnOne(myUserId, opponentUserId string) StoreResult

func RdbSelectRoomUsersByRoomId added in v0.2.0

func RdbSelectRoomUsersByRoomId(roomId string) StoreResult

func RdbSelectRoomUsersByRoomIdAndUserIds added in v0.2.0

func RdbSelectRoomUsersByRoomIdAndUserIds(roomId *string, userIds []string) StoreResult

func RdbSelectRoomUsersByUserId added in v0.2.0

func RdbSelectRoomUsersByUserId(userId string) StoreResult

func RdbSelectRooms added in v0.2.0

func RdbSelectRooms() StoreResult

func RdbSelectSubscription added in v0.2.0

func RdbSelectSubscription(roomId, userId string, platform int) StoreResult

func RdbSelectUser added in v0.2.0

func RdbSelectUser(userId string, isWithRooms, isWithDevices, isWithBlocks bool) StoreResult

func RdbSelectUserByUserIdAndAccessToken added in v0.5.0

func RdbSelectUserByUserIdAndAccessToken(userId, accessToken string) StoreResult

func RdbSelectUserIdsByUserIds added in v0.2.0

func RdbSelectUserIdsByUserIds(userIds []string) StoreResult

func RdbSelectUsers added in v0.2.0

func RdbSelectUsers() StoreResult

func RdbSelectUsersForRoom added in v0.2.0

func RdbSelectUsersForRoom(roomId string) StoreResult

func RdbUpdateDevice added in v0.2.0

func RdbUpdateDevice(device *models.Device) StoreResult

func RdbUpdateMessage added in v0.2.0

func RdbUpdateMessage(message *models.Message) StoreResult

func RdbUpdateRoom added in v0.2.0

func RdbUpdateRoom(room *models.Room) StoreResult

func RdbUpdateRoomDeleted added in v0.2.0

func RdbUpdateRoomDeleted(roomId string) StoreResult

func RdbUpdateRoomUser added in v0.2.0

func RdbUpdateRoomUser(roomUser *models.RoomUser) StoreResult

func RdbUpdateUser added in v0.2.0

func RdbUpdateUser(user *models.User) StoreResult

func RdbUpdateUserDeleted added in v0.2.0

func RdbUpdateUserDeleted(userId string) StoreResult

type SubscriptionStore added in v0.2.0

type SubscriptionStore interface {
	CreateSubscriptionStore()

	InsertSubscription(subscription *models.Subscription) StoreResult
	SelectSubscription(roomId, userId string, platform int) StoreResult
	SelectDeletedSubscriptionsByRoomId(roomId string) StoreResult
	SelectDeletedSubscriptionsByUserId(userId string) StoreResult
	SelectDeletedSubscriptionsByUserIdAndPlatform(userId string, platform int) StoreResult
	DeleteSubscription(subscription *models.Subscription) StoreResult
}

type UserStore

type UserStore interface {
	CreateUserStore()

	InsertUser(user *models.User) StoreResult
	SelectUser(userId string, isWithRooms, isWithDevices, isWithBlocks bool) StoreResult
	SelectUserByUserIdAndAccessToken(userId, accessToken string) StoreResult
	SelectUsers() StoreResult
	SelectUserIdsByUserIds(userIds []string) StoreResult
	UpdateUser(user *models.User) StoreResult
	UpdateUserDeleted(userId string) StoreResult
	SelectContacts(userId string) StoreResult
}

Jump to

Keyboard shortcuts

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