db

package
v0.0.0-...-5c68377 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteUser

func DeleteUser(id ss.UserID, db ddb.Client) (bool, error)

func NewConnectionKey

func NewConnectionKey(id ss.ConnectionID) connectionKey

func NewUserAnonymousRecordExpirationTime

func NewUserAnonymousRecordExpirationTime(start ss.Time) *ss.Time

Types

type Connection

type Connection struct {
	ConnectionKeyValue
	User           ss.UserID `json:"user"`
	Version        string    `json:"ver"`
	ExpirationTime ss.Time   `json:"expiration"`
	// contains filtered or unexported fields
}

Connection describes the record of a table with active connections.

func NewConnection

func NewConnection(
	id ss.ConnectionID,
	user ss.UserID,
	version string,
) Connection

NewConnection creates new connection record.

func (Connection) GetData

func (record Connection) GetData() interface{}

GetData returns record's data.

func (Connection) GetKeyPartitionField

func (Connection) GetKeyPartitionField() string

GetKeyPartitionField returns partition field name.

func (Connection) GetKeySortField

func (Connection) GetKeySortField() string

GetKeySortField returns sort field name.

func (Connection) GetTable

func (Connection) GetTable() string

GetTable returns table name.

type ConnectionIDByUser

type ConnectionIDByUser struct {
	ConnectionUserIndex
	ID ss.ConnectionID `json:"id"`
}

func (*ConnectionIDByUser) Clear

func (record *ConnectionIDByUser) Clear()

func (ConnectionIDByUser) GetKeyPartitionField

func (ConnectionIDByUser) GetKeyPartitionField() string

GetKeyPartitionField returns partition field name.

func (ConnectionIDByUser) GetKeySortField

func (ConnectionIDByUser) GetKeySortField() string

GetKeySortField returns sort field name.

func (ConnectionIDByUser) GetTable

func (ConnectionIDByUser) GetTable() string

GetTable returns table name.

type ConnectionKeyValue

type ConnectionKeyValue struct {
	ID ss.ConnectionID `json:"id"`
}

type ConnectionUserIndex

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

ConnectionUserIndex describes connection index "bu user".

func (ConnectionUserIndex) GetIndex

func (ConnectionUserIndex) GetIndex() string

GetIndex returns index name.

func (ConnectionUserIndex) GetIndexPartitionField

func (ConnectionUserIndex) GetIndexPartitionField() string

GetIndexPartitionField returns index partition field name.

func (ConnectionUserIndex) GetIndexSortField

func (ConnectionUserIndex) GetIndexSortField() string

GetIndexSortField returns index sort field name.

func (ConnectionUserIndex) GetKeyPartitionField

func (ConnectionUserIndex) GetKeyPartitionField() string

GetKeyPartitionField returns partition field name.

func (ConnectionUserIndex) GetKeySortField

func (ConnectionUserIndex) GetKeySortField() string

GetKeySortField returns sort field name.

func (ConnectionUserIndex) GetProjection

func (ConnectionUserIndex) GetProjection() []string

func (ConnectionUserIndex) GetTable

func (ConnectionUserIndex) GetTable() string

GetTable returns table name.

type Device

type Device struct {
	DeviceRecord
	DeviceKeyValue
	ID   ss.DeviceID     `json:"id"`
	User ss.UserID       `json:"user"`
	Key  DeviceCryptoKey `json:"key"`
}

func NewDevice

func NewDevice(
	id ss.DeviceID,
	fcmToken ss.FirebaseCloudMessagingToken,
	user ss.UserID,
	key DeviceCryptoKey,
) Device

func (*Device) Clear

func (record *Device) Clear()

func (Device) GetData

func (record Device) GetData() interface{}

func (Device) MarshalLogMsg

func (record Device) MarshalLogMsg(destination map[string]interface{})

type DeviceCryptoKey

type DeviceCryptoKey = crypto.AES128Key

type DeviceKey

type DeviceKey struct {
	DeviceRecord
	DeviceKeyValue
}

func NewDeviceKey

func NewDeviceKey(fcmToken ss.FirebaseCloudMessagingToken) DeviceKey

func (DeviceKey) GetKey

func (key DeviceKey) GetKey() interface{}

type DeviceKeyValue

type DeviceKeyValue struct {
	FCMToken ss.FirebaseCloudMessagingToken `json:"fcm"`
}

type DeviceRecord

type DeviceRecord struct{}

func (DeviceRecord) GetKeyPartitionField

func (DeviceRecord) GetKeyPartitionField() string

func (DeviceRecord) GetKeySortField

func (DeviceRecord) GetKeySortField() string

func (DeviceRecord) GetTable

func (DeviceRecord) GetTable() string

type DeviceUserIndex

type DeviceUserIndex struct{ DeviceRecord }

func (DeviceUserIndex) GetIndex

func (DeviceUserIndex) GetIndex() string

GetIndex returns index name.

func (DeviceUserIndex) GetIndexPartitionField

func (DeviceUserIndex) GetIndexPartitionField() string

GetIndexPartitionField returns index partition field name.

func (DeviceUserIndex) GetIndexSortField

func (DeviceUserIndex) GetIndexSortField() string

GetIndexSortField returns index sort field name.

func (DeviceUserIndex) GetProjection

func (DeviceUserIndex) GetProjection() []string

type FindUserConnectionsIterator

type FindUserConnectionsIterator interface {
	Next() bool
	Get() ss.ConnectionID
}

IteratorMover describes intreface to move iterator.

func FindUserConnections

func FindUserConnections(
	user ss.UserID,
	db ddb.Client,
) FindUserConnectionsIterator

type User

type User struct {
	UserRecord

	FirebaseID   string  `json:"fId"`
	CreationTime ss.Time `json:"created"`
	// SpotMembershipVersion increases each time when the user joins an event
	// spot or leaves it.
	SpotMembershipVersion ddb.MembershipVersion `json:"spotsVer"`
	// OriginalName is the name from the user record source (like Firbase).
	OriginalName string `json:"origName"`
	// OwnName is the name that user set by the app.
	OwnName                       string   `json:"ownName,omitempty"`
	Email                         string   `json:"email,omitempty"`
	PhoneNumber                   string   `json:"phone,omitempty"`
	PhotoURL                      string   `json:"photoUrl,omitempty"`
	AnonymousRecordExpirationTime *ss.Time `json:"anonymExpiration,omitempty"`
	// contains filtered or unexported fields
}

User describes user record fields.

func NewFirebaseUser

func NewFirebaseUser(
	firebaseID string,
	name string,
	isAnonymous bool,
) (User, userUniqueIndex)

NewUser generates new user record.

func (User) GetData

func (record User) GetData() interface{}

func (User) GetName

func (record User) GetName() string

func (User) IsAnonymous

func (record User) IsAnonymous() bool

type UserExternalFirabaseIDIndex

type UserExternalFirabaseIDIndex struct{ UserRecord }

func (UserExternalFirabaseIDIndex) GetIndex

func (UserExternalFirabaseIDIndex) GetIndexPartitionField

func (UserExternalFirabaseIDIndex) GetIndexPartitionField() string

func (UserExternalFirabaseIDIndex) GetIndexSortField

func (UserExternalFirabaseIDIndex) GetIndexSortField() string

func (UserExternalFirabaseIDIndex) GetProjection

func (UserExternalFirabaseIDIndex) GetProjection() []string

type UserKey

type UserKey struct {
	UserRecord
	// contains filtered or unexported fields
}

UserKey is an object ot looks for user by primary key.

func NewUserKey

func NewUserKey(id ss.UserID) UserKey

NewUserKey creates new user key instance.

func (UserKey) GetKey

func (key UserKey) GetKey() interface{}

GetKey returns user key data.

type UserRecord

type UserRecord struct{}

func (UserRecord) GetKeyPartitionField

func (UserRecord) GetKeyPartitionField() string

func (UserRecord) GetKeySortField

func (UserRecord) GetKeySortField() string

func (UserRecord) GetTable

func (UserRecord) GetTable() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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