database

package
v0.0.0-...-d075ec7 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2024 License: Unlicense Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultOpts = Opts{
	NeedRedis:       true,
	NeedMongodb:     true,
	NeedAuthService: true,
}

Functions

func New

func New(
	ctx context.Context,
	logger contract.Logger,
	opts ...Opts,
) contract.Store

Types

type Message

type Message struct {
	Id        primitive.ObjectID `bson:"_id,omitempty"`
	Content   string             `bson:"content"`
	SenderId  primitive.ObjectID `bson:"sender_id"`
	RoomId    primitive.ObjectID `bson:"room_id"`
	Timestamp time.Time          `bson:"timestamp"`
}

type Notification

type Notification struct {
	Id                 primitive.ObjectID `bson:"_id,omitempty"`
	SenderId           primitive.ObjectID `bson:"sender_id,omitempty"`
	RoomId             primitive.ObjectID `bson:"room_id,omitempty"`
	NotificationRoomId primitive.ObjectID `bson:"notification_room_id,omitempty"`
	Content            string             // TODO
	CreateAt           time.Time          `bson:"create_at"`
	ReadNotification   bool               `bson:"read_notification"`
}

type NotificationRoom

type NotificationRoom struct {
	Id       primitive.ObjectID `bson:"_id,omitempty"`
	UserId   primitive.ObjectID `bson:"user_id,omitempty"`
	RoomId   primitive.ObjectID `bson:"room_id,omitempty"`
	CreateAt time.Time          `bson:"create_at"`
	Enable   bool               `bson:"enable"`
}

type Opts

type Opts struct {
	NeedRedis       bool
	NeedMongodb     bool
	NeedAuthService bool

	NeedBrokerRoom         bool
	NeedBrokerMessage      bool
	NeedBrokerNotification bool
}

type Room

type Room struct {
	Id          primitive.ObjectID `bson:"_id,omitempty"`
	Name        string             `bson:"name"`
	Description string             `bson:"description"`

	AllowUsers []string // TODO:#feature

	UserId string // TODO:#feature, add how user create this room

	IsOpen bool // TODO: #feature

	CreateAt time.Time `json:"create_at"`
	CloseAt  time.Time // TODO: #feature
}

type User

type User struct {
	Id       primitive.ObjectID `bson:"_id,omitempty"`
	Username string             `bson:"username"`
	Email    string             `bson:"email"`
	Password string             `bson:"password"`

	Notification bool `bson:"notification"`

	CreateAt time.Time `bson:"create_at"`
}

Directories

Path Synopsis
TODO: make mock database
TODO: make mock database

Jump to

Keyboard shortcuts

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