Documentation ¶
Index ¶
- Constants
- Variables
- func Close(ctx context.Context) error
- func Connect(ctx context.Context) error
- func Connected() bool
- func Create(ctx context.Context, model Model) error
- func Delete(ctx context.Context, model Model) error
- func DisableCache()
- func EnableCache()
- func ErrDuplicateEntry(model Model, value interface{}, wrapped error) error
- func ErrInvalidID(value interface{}, wrapped error) error
- func ErrNotFound(model Model, id interface{}, wrapped error) error
- func FindStr(slice []string, val string) int
- func ForEachModel(handle func(Model))
- func GeneratePassword() (string, error)
- func GenerateRandomBytes(n int) ([]byte, error)
- func GenerateRandomString(min, max int) (string, error)
- func GenerateSecret() (string, error)
- func Get(ctx context.Context, id string, model Model) error
- func GetAppSearchKey(app, name string) string
- func GetByID(ctx context.Context, id interface{}, model CollectionModel) error
- func GetRoomSearchKey(customer, name string) string
- func Init(config *Config)
- func Initialized() bool
- func IsDuplicate(err error) bool
- func MakeError(code int, model Model, data interface{}, wrapped error, format string, ...) error
- func ModelEvent(model Model, name string) event.Event
- func ModelEventHandler(handler func(Event, Model)) event.Handler
- func Ping(ctx context.Context) bool
- func Ready() bool
- func Save(ctx context.Context, model Model) error
- func Set(ctx context.Context, model Model, insert bool) error
- func ValidateID(id string) error
- func Wait()
- type App
- func (app *App) Cache(status bool)
- func (app *App) CacheKey() string
- func (app *App) Cached(id string) bool
- func (app *App) Collection() string
- func (app *App) Create(ctx context.Context) error
- func (app *App) Decode(data []byte) error
- func (app *App) Delete(ctx context.Context) error
- func (app *App) Encode() ([]byte, error)
- func (app *App) Get(ctx context.Context, id string) error
- func (app *App) GetByName(ctx context.Context, customer, name string) error
- func (app *App) GetCustomer(ctx context.Context) (*Customer, error)
- func (app *App) GetCustomerID() string
- func (app *App) GetID() string
- func (app *App) GetKey() string
- func (app *App) GetUserID() string
- func (app *App) Init()
- func (app *App) List() ModelList
- func (app *App) New() Model
- func (app *App) ObjectID() interface{}
- func (app *App) OnCreate(ctx context.Context) error
- func (app *App) OnDelete(ctx context.Context) error
- func (app *App) OnUpdate(ctx context.Context) error
- func (app *App) SetCustomerID(id string) error
- func (app *App) SetID(id string) error
- func (app *App) String() string
- func (app *App) Type() string
- func (app *App) Update(ctx context.Context) error
- type AppList
- func (apps *AppList) All() []*App
- func (apps *AppList) Collection() string
- func (apps *AppList) Get(ctx context.Context, start string, limit int) error
- func (apps *AppList) GetByCustomer(ctx context.Context, id string, active bool) error
- func (apps *AppList) GetByUser(ctx context.Context, user, start string, limit int) error
- func (apps *AppList) Index(index int) Model
- func (apps *AppList) Length() int
- func (apps *AppList) New() Model
- type Auth
- func (auth *Auth) AccessKey() string
- func (auth *Auth) Cache(status bool)
- func (auth *Auth) CacheKey() string
- func (auth *Auth) Cached(accessKey string) bool
- func (auth *Auth) CanCreate(model Model) bool
- func (auth *Auth) CanDelete(model Model) bool
- func (auth *Auth) CanGet(model Model) bool
- func (auth *Auth) CanList(model Model) bool
- func (auth *Auth) CanUpdate(model Model) bool
- func (auth *Auth) Collection() string
- func (auth *Auth) Create(ctx context.Context) error
- func (auth *Auth) CreateSecret() error
- func (auth *Auth) Decode(data []byte) error
- func (auth *Auth) Delete(ctx context.Context) error
- func (auth *Auth) Encode() ([]byte, error)
- func (auth *Auth) Get(ctx context.Context, id string) error
- func (auth *Auth) GetApp(ctx context.Context) (*App, error)
- func (auth *Auth) GetAppID() string
- func (auth *Auth) GetCustomer(ctx context.Context) (*Customer, error)
- func (auth *Auth) GetCustomerID() string
- func (auth *Auth) GetID() string
- func (auth *Auth) GetSecret() string
- func (auth *Auth) GetUser(ctx context.Context) (*User, error)
- func (auth *Auth) GetUserID() string
- func (auth *Auth) Init()
- func (auth *Auth) IsAdmin() bool
- func (auth *Auth) IsAppAuth() bool
- func (auth *Auth) IsCustomerAuth() bool
- func (auth *Auth) IsOwner(model Model) bool
- func (auth *Auth) IsRevoked(id string) bool
- func (auth *Auth) List() ModelList
- func (auth *Auth) New() Model
- func (auth *Auth) ObjectID() interface{}
- func (auth *Auth) OnCreate(ctx context.Context) error
- func (auth *Auth) OnDelete(ctx context.Context) error
- func (auth *Auth) OnUpdate(ctx context.Context) error
- func (auth *Auth) Revoke(id string) bool
- func (auth *Auth) SetAppID(id string) error
- func (auth *Auth) SetCustomerID(id string) error
- func (auth *Auth) SetID(id string) error
- func (auth *Auth) SetUserID(id string) error
- func (auth *Auth) String() string
- func (auth *Auth) Type() string
- func (auth *Auth) Update(ctx context.Context) error
- type AuthList
- func (auths *AuthList) All() []*Auth
- func (auths *AuthList) Collection() string
- func (auths *AuthList) Find(ctx context.Context, user, customer, app string, active bool) error
- func (auths *AuthList) Get(ctx context.Context, start string, limit int) error
- func (auths *AuthList) GetByUser(ctx context.Context, user, start string, limit int) error
- func (auths *AuthList) Index(index int) Model
- func (auths *AuthList) Length() int
- func (auths *AuthList) New() Model
- type AuthProvider
- type Cache
- func (c *Cache) Delete(key string)
- func (c *Cache) Disable()
- func (c *Cache) Enable()
- func (c *Cache) Expiration(duration time.Duration)
- func (c *Cache) Get(key string) Model
- func (c *Cache) GetKey(collection, id string) string
- func (c *Cache) Reset()
- func (c *Cache) Save(key string, model Model)
- func (c *Cache) SaveNoExpire(key string, model Model)
- func (c *Cache) SaveWithExpiration(key string, model Model, duration time.Duration)
- type CollectionModel
- type Config
- type Counter
- func (counter *Counter) Cache(status bool)
- func (counter *Counter) Cached(id string) bool
- func (counter *Counter) Collection() string
- func (counter *Counter) Create(ctx context.Context) error
- func (counter *Counter) CustomerID() primitive.ObjectID
- func (counter *Counter) Decode(data []byte) error
- func (counter *Counter) Delete(ctx context.Context) error
- func (counter *Counter) Encode() ([]byte, error)
- func (counter *Counter) Get(ctx context.Context, id string) error
- func (counter *Counter) GetCustomer(ctx context.Context) (*Customer, error)
- func (counter *Counter) GetID() string
- func (counter *Counter) List() ModelList
- func (counter *Counter) New() Model
- func (counter *Counter) ObjectID() interface{}
- func (counter *Counter) OnCreate(ctx context.Context) error
- func (counter *Counter) OnDelete(ctx context.Context) error
- func (counter *Counter) OnUpdate(ctx context.Context) error
- func (counter *Counter) Reset(ctx context.Context) error
- func (counter *Counter) SetID(id string) error
- func (counter *Counter) String() string
- func (counter *Counter) Type() string
- func (counter *Counter) Update(ctx context.Context) error
- func (counter *Counter) UpdateBandwidth(ctx context.Context, value int64) error
- func (counter *Counter) UpdateSubscription(ctx context.Context, value int64) error
- type Credentials
- type Customer
- func (customer *Customer) Cache(status bool)
- func (customer *Customer) CacheKey() string
- func (customer *Customer) Cached(id string) bool
- func (customer *Customer) Collection() string
- func (customer *Customer) Create(ctx context.Context) error
- func (customer *Customer) CreateCounter(ctx context.Context) error
- func (customer *Customer) Decode(data []byte) error
- func (customer *Customer) Delete(ctx context.Context) error
- func (customer *Customer) Encode() ([]byte, error)
- func (customer *Customer) Get(ctx context.Context, id string) error
- func (customer *Customer) GetByUserID(ctx context.Context, user string) error
- func (customer *Customer) GetCounters(ctx context.Context) (*Counter, error)
- func (customer *Customer) GetID() string
- func (customer *Customer) GetUser(ctx context.Context) (*User, error)
- func (customer *Customer) GetUserID() string
- func (customer *Customer) Init()
- func (customer *Customer) List() ModelList
- func (customer *Customer) New() Model
- func (customer *Customer) ObjectID() interface{}
- func (customer *Customer) OnCreate(ctx context.Context) error
- func (customer *Customer) OnDelete(ctx context.Context) error
- func (customer *Customer) OnUpdate(ctx context.Context) error
- func (customer *Customer) SetID(id string) error
- func (customer *Customer) SetUserID(id string) error
- func (customer *Customer) String() string
- func (customer *Customer) Type() string
- func (customer *Customer) Update(ctx context.Context) error
- func (customer *Customer) UpdatePlan(subs, bw, rsize, rcount, pcount int64)
- func (customer *Customer) UpdateWebhook(url string, headers map[string]string)
- type CustomerList
- func (customers *CustomerList) All() []*Customer
- func (customers *CustomerList) Collection() string
- func (customers *CustomerList) Get(ctx context.Context, start string, limit int) error
- func (customers *CustomerList) GetByUser(ctx context.Context, user, start string, limit int) error
- func (customers *CustomerList) Index(index int) Model
- func (customers *CustomerList) Length() int
- func (customers *CustomerList) New() Model
- type Database
- type Error
- type Event
- type EventHandler
- type Indexer
- type Model
- type ModelList
- type Monitor
- type Plan
- type Request
- type Response
- type Room
- func (room *Room) Cache(status bool)
- func (room *Room) CacheKey() string
- func (room *Room) Cached(id string) bool
- func (room *Room) Collection() string
- func (room *Room) Create(ctx context.Context) error
- func (room *Room) Decode(data []byte) error
- func (room *Room) Delete(ctx context.Context) error
- func (room *Room) Encode() ([]byte, error)
- func (room *Room) Get(ctx context.Context, id string) error
- func (room *Room) GetByName(ctx context.Context, customer, name string) error
- func (room *Room) GetCustomer(ctx context.Context) (*Customer, error)
- func (room *Room) GetCustomerID() string
- func (room *Room) GetID() string
- func (room *Room) GetKey() string
- func (room *Room) GetUserID() string
- func (room *Room) Init()
- func (room *Room) List() ModelList
- func (room *Room) New() Model
- func (room *Room) ObjectID() interface{}
- func (room *Room) OnCreate(ctx context.Context) error
- func (room *Room) OnDelete(ctx context.Context) error
- func (room *Room) OnUpdate(ctx context.Context) error
- func (room *Room) SetCustomerID(id string) error
- func (room *Room) SetID(id string) error
- func (room *Room) SetUserID(id string) error
- func (room Room) String() string
- func (room *Room) Type() string
- func (room *Room) Update(ctx context.Context) error
- func (room *Room) UpdatePermission(role string, publish, subscribe, commands []string)
- func (room *Room) UpdateRecording(enabled bool, size int64, duration time.Duration)
- type RoomList
- func (rooms *RoomList) All() []*Room
- func (rooms *RoomList) Collection() string
- func (rooms *RoomList) Get(ctx context.Context, start string, limit int) error
- func (rooms *RoomList) GetByUser(ctx context.Context, user, start string, limit int) error
- func (rooms *RoomList) Index(index int) Model
- func (rooms *RoomList) Length() int
- func (rooms *RoomList) New() Model
- type RoomPermissionEntry
- type RoomRecording
- type Sequence
- func (sequence *Sequence) Cache(status bool)
- func (sequence *Sequence) Cached(id string) bool
- func (sequence *Sequence) Collection() string
- func (sequence *Sequence) Create(ctx context.Context) error
- func (sequence *Sequence) Decode(data []byte) error
- func (sequence *Sequence) Delete(ctx context.Context) error
- func (sequence *Sequence) Encode() ([]byte, error)
- func (sequence *Sequence) Get(ctx context.Context, name string) error
- func (sequence *Sequence) GetID() string
- func (sequence *Sequence) List() ModelList
- func (sequence *Sequence) MarshalJSON() ([]byte, error)
- func (sequence *Sequence) Name() string
- func (sequence *Sequence) New() Model
- func (sequence *Sequence) Next(ctx context.Context) (int64, error)
- func (sequence *Sequence) ObjectID() interface{}
- func (sequence *Sequence) OnCreate(ctx context.Context) error
- func (sequence *Sequence) OnDelete(ctx context.Context) error
- func (sequence *Sequence) OnUpdate(ctx context.Context) error
- func (sequence *Sequence) Reset(ctx context.Context, value int64) error
- func (sequence *Sequence) SetID(id string) error
- func (sequence *Sequence) String() string
- func (sequence *Sequence) Type() string
- func (sequence *Sequence) UnmarshalJSON(data []byte) error
- func (sequence *Sequence) Update(ctx context.Context) error
- func (sequence *Sequence) UpdateValue(ctx context.Context) error
- type Session
- func (session *Session) Cache(status bool)
- func (session *Session) CacheKey() string
- func (session *Session) Cached(id string) bool
- func (session *Session) Collection() string
- func (session *Session) Create(ctx context.Context) error
- func (session *Session) Decode(data []byte) error
- func (session *Session) Delete(ctx context.Context) error
- func (session *Session) Encode() ([]byte, error)
- func (session *Session) Get(ctx context.Context, id string) error
- func (session *Session) GetCustomer(ctx context.Context) (*Customer, error)
- func (session *Session) GetCustomerID() string
- func (session *Session) GetID() string
- func (session *Session) GetRoom(ctx context.Context) (*Room, error)
- func (session *Session) GetRoomID() string
- func (session *Session) GetUser(ctx context.Context) (*User, error)
- func (session *Session) GetUserID() string
- func (session *Session) Init()
- func (session *Session) List() ModelList
- func (session *Session) New() Model
- func (session *Session) ObjectID() interface{}
- func (session *Session) OnCreate(ctx context.Context) error
- func (session *Session) OnDelete(ctx context.Context) error
- func (session *Session) OnUpdate(ctx context.Context) error
- func (session *Session) SetCustomerID(id string) error
- func (session *Session) SetID(id string) error
- func (session *Session) SetRoomID(id string) error
- func (session *Session) SetUserID(id string) error
- func (session Session) String() string
- func (session *Session) Type() string
- func (session *Session) Update(ctx context.Context) error
- func (session *Session) UpdateRecording(location string, size int64, duration time.Duration)
- type SessionList
- func (sessions *SessionList) All() []*Session
- func (sessions *SessionList) Collection() string
- func (sessions *SessionList) Get(ctx context.Context, start string, limit int) error
- func (sessions *SessionList) GetByUser(ctx context.Context, user, start string, limit int) error
- func (sessions *SessionList) Index(index int) Model
- func (sessions *SessionList) Length() int
- func (sessions *SessionList) New() Model
- type SessionRecording
- type UploadInfo
- type User
- func (user *User) AddRole(role string) bool
- func (user *User) Cache(status bool)
- func (user *User) CacheKey() string
- func (user *User) Cached(id string) bool
- func (user *User) Collection() string
- func (user *User) Create(ctx context.Context) error
- func (user *User) Decode(data []byte) error
- func (user *User) Delete(ctx context.Context) error
- func (user *User) Encode() ([]byte, error)
- func (user *User) Get(ctx context.Context, id string) error
- func (user *User) GetByEmail(ctx context.Context, email string) error
- func (user *User) GetID() string
- func (user *User) HasRole(role string) bool
- func (user *User) Init()
- func (user *User) List() ModelList
- func (user *User) Locked() bool
- func (user *User) New() Model
- func (user *User) ObjectID() interface{}
- func (user *User) OnCreate(ctx context.Context) error
- func (user *User) OnDelete(ctx context.Context) error
- func (user *User) OnUpdate(ctx context.Context) error
- func (user *User) SetID(id string) error
- func (user *User) SetPassword(password string) error
- func (user *User) String() string
- func (user *User) Type() string
- func (user *User) Update(ctx context.Context) error
- func (user *User) VerifyPassword(password string) bool
- type UserList
- func (users *UserList) All() []*User
- func (users *UserList) Collection() string
- func (users *UserList) Get(ctx context.Context, start string, limit int) error
- func (users *UserList) Index(index int) Model
- func (users *UserList) Length() int
- func (users *UserList) Limit() int
- func (users *UserList) New() Model
- type UserModelList
- type Webhook
Constants ¶
const ( // ErrCodeNotFound not found in database ErrCodeNotFound int = iota + 1 // ErrCodeNotInitialized not intialized ErrCodeNotInitialized // ErrCodeNotConnected not connected ErrCodeNotConnected // ErrCodeDuplicateEntry ... ErrCodeDuplicateEntry // ErrCodeInvalidID ... ErrCodeInvalidID )
Variables ¶
var ( // DefaultAppName default app name DefaultAppName = "Default" // DefaultAppDescription default app description DefaultAppDescription = "Default App created automatically" )
var ( // ErrNotInitialized ... ErrNotInitialized = MakeError(ErrCodeNotInitialized, nil, nil, nil, "not initialized") // ErrNotConnected not connected ErrNotConnected = MakeError(ErrCodeNotConnected, nil, nil, nil, "not connected") // Now Current Time Now = utc )
var ( // ErrDuplicateIndexer diplicate indexer ErrDuplicateIndexer = errors.New("Duplicate indexer") // ErrIndexingLocked indexing already started or done ErrIndexingLocked = errors.New("Indexing is locked") )
var ( // DefaultListLimit ... DefaultListLimit = 10 // MaxListLimit ... MaxListLimit = 100 )
var ( // SecretLength ... SecretLength = 128 // PasswordMin ... PasswordMin = 8 // PasswordMax ... PasswordMax = 64 )
Functions ¶
func ErrDuplicateEntry ¶
ErrDuplicateEntry ...
func ErrNotFound ¶
ErrNotFound ...
func GenerateRandomBytes ¶
GenerateRandomBytes returns securely generated random bytes. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.
func GenerateRandomString ¶
GenerateRandomString returns a URL-safe, base64 encoded securely generated random string. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.
func GetByID ¶
func GetByID(ctx context.Context, id interface{}, model CollectionModel) error
GetByID get model by ID
func MakeError ¶
func MakeError(code int, model Model, data interface{}, wrapped error, format string, v ...interface{}) error
MakeError ...
func ModelEventHandler ¶
ModelEventHandler ...
Types ¶
type App ¶
type App struct { ID primitive.ObjectID `bson:"_id,omitempty"` CustomerID primitive.ObjectID `bson:"customer_id,omitempty"` UserID primitive.ObjectID `bson:"user_id,omitempty"` Key string `bson:"key,omitempty"` Name string `bson:"name"` Active bool `bson:"active"` Description string `bson:"description,omitempty"` CreatedAt time.Time `bson:"created_at,omitempty"` UpdatedAt time.Time `bson:"updated_at,omitempty"` Customer *Customer `bson:"-"` }
App app info
func (*App) GetCustomer ¶
GetCustomer Get auth app
type AppList ¶
type AppList struct {
// contains filtered or unexported fields
}
AppList ...
func (*AppList) GetByCustomer ¶
GetByCustomer get apps by customer
type Auth ¶
type Auth struct { ID primitive.ObjectID ` bson:"_id,omitempty"` UserID primitive.ObjectID `bson:"user_id,omitempty"` CustomerID primitive.ObjectID `bson:"customer_id,omitempty"` AppID primitive.ObjectID `bson:"app_id,omitempty"` Active bool `bson:"active,omitempty"` Admin bool `bson:"admin,omitempty"` Secret string `bson:"secret,omitempty"` Revoked []string `bson:"revoked,omitempty"` CreatedAt time.Time `bson:"created_at,omitempty"` UpdatedAt time.Time `bson:"updated_at,omitempty"` User *User `bson:"-"` App *App `bson:"-"` Customer *Customer `bson:"-"` }
Auth auth info
func (*Auth) CreateSecret ¶
CreateSecret create new secret for auth
func (*Auth) GetCustomer ¶
GetCustomer Get auth app
type AuthList ¶
type AuthList struct {
// contains filtered or unexported fields
}
AuthList ...
type CollectionModel ¶
type CollectionModel interface {
Collection() string
}
CollectionModel collection Model
type Config ¶
type Config struct { URL string `mapstructure:"url"` Database string `mapstructure:"database"` ConnectTimeout int `mapstructure:"connect_timeout,omitempty"` SocketTimeout int `mapstructure:"socket_timeout,omitempty"` Monitoring bool `mapstructure:"monitor,omitempty"` Caching bool `mapstructure:"cache,omitempty"` // contains filtered or unexported fields }
Config database config
type Counter ¶
type Counter struct { ID primitive.ObjectID `bson:"_id,omitempty"` Subscription int64 `bson:"subscription,omitempty"` Bandwidth int64 `bson:"bandwidth,omitempty"` Customer *Customer }
Counter ...
func (*Counter) GetCustomer ¶
GetCustomer Get auth app
func (*Counter) UpdateBandwidth ¶
UpdateBandwidth add subscription
type Credentials ¶
type Credentials struct { Key string `bson:"key,omitempty"` Secret string `bson:"secret,omitempty"` }
Credentials for upload
type Customer ¶
type Customer struct { ID primitive.ObjectID `bson:"_id,omitempty"` UserID primitive.ObjectID `bson:"user_id,omitempty"` Active bool `bson:"active,omitempty"` Plan *Plan `bson:"plan,omitempty"` Webhook *Webhook `bson:"webhook,omitempty"` CreatedAt time.Time `bson:"created_at,omitempty"` UpdatedAt time.Time `bson:"updated_at,omitempty"` User *User `bson:"-"` Counter *Counter `bson:"-"` }
Customer Customer Info
func (*Customer) Collection ¶
Collection model collection
func (*Customer) CreateCounter ¶
CreateCounter ...
func (*Customer) GetByUserID ¶
GetByUserID ...
func (*Customer) GetCounters ¶
GetCounters get counters
func (*Customer) UpdatePlan ¶
UpdatePlan ...
type CustomerList ¶
type CustomerList struct {
// contains filtered or unexported fields
}
CustomerList ...
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database ...
func (*Database) Collection ¶
func (db *Database) Collection(model CollectionModel) *mongo.Collection
Collection get collection from db
func (*Database) WithTimeout ¶
WithTimeout ...
type Error ¶
type Error struct { Code int Message string Data interface{} Line int Model Model Function string File string Wrapped error }
Error ...
type EventHandler ¶
type EventHandler struct {
// contains filtered or unexported fields
}
EventHandler ...
type Indexer ¶
type Indexer struct {
// contains filtered or unexported fields
}
Indexer database Indexer
type Model ¶
type Model interface { CollectionModel List() ModelList Type() string New() Model ObjectID() interface{} GetID() string SetID(string) error OnCreate(ctx context.Context) error OnUpdate(ctx context.Context) error OnDelete(ctx context.Context) error Get(ctx context.Context, id string) error Create(ctx context.Context) error Delete(ctx context.Context) error Update(ctx context.Context) error // Binary encoder decoder used by caching Encode() ([]byte, error) Decode([]byte) error // Caching Cache(status bool) Cached(id string) bool }
Model interface for database model
type ModelList ¶
type ModelList interface { CollectionModel Length() int New() Model Index(int) Model Get(ctx context.Context, start string, limit int) error }
ModelList ...
type Plan ¶
type Plan struct { Subscription int64 `bson:"subscription,omitempty"` Bandwidth int64 `bson:"bandwidth,omitempty"` RoomSize int64 `bson:"room_size,omitempty"` RoomCount int64 `bson:"room_count,omitempty"` PeerCount int64 `bson:"peer_count,omitempty"` }
Plan customer Plan
type Room ¶
type Room struct { ID primitive.ObjectID `bson:"_id,omitempty"` CustomerID primitive.ObjectID `bson:"customer_id,omitempty"` UserID primitive.ObjectID `bson:"user_id,omitempty"` Key string `bson:"key,omitempty"` Name string `bson:"name,omitempty"` Active bool `bson:"active,omitempty"` Description string `bson:"description,omitempty"` Roles []string `bson:"roles,omitempty"` Size int `bson:"size,omitempty"` Locked bool `bson:"locked,omitempty"` Waiting bool `bson:"waiting,omitempty"` Template string `bson:"template,omitempty"` Recording *RoomRecording `bson:"recording,omitempty"` Permissions map[string]*RoomPermissionEntry `bson:"permissions,omitempty"` CreatedAt time.Time `bson:"created_at,omitempty"` UpdatedAt time.Time `bson:"updated_at,omitempty"` Customer *Customer `bson:"-"` User *User `bson:"-"` }
Room ...
func (*Room) GetCustomer ¶
GetCustomer Get auth room
func (*Room) UpdatePermission ¶
UpdatePermission ...
type RoomList ¶
type RoomList struct {
// contains filtered or unexported fields
}
RoomList ...
type RoomPermissionEntry ¶
type RoomPermissionEntry struct { Publish []string `bson:"publish,omitempty"` Subscribe []string `bson:"subscribe,omitempty"` Commands []string `bson:"commands,omitempty"` }
RoomPermissionEntry permission for room
type RoomRecording ¶
type RoomRecording struct { Enabled bool `bson:"enabled,omitempty"` Size int64 `bson:"size,omitempty"` Duration time.Duration `bson:"duration,omitempty"` Upload *UploadInfo `bson:"upload,omitempty"` }
RoomRecording recording info
func (*RoomRecording) UpdateUploadInfo ¶
func (recording *RoomRecording) UpdateUploadInfo(uploadType, location, prefix string, options map[string]string)
UpdateUploadInfo Update upload info
type Sequence ¶
type Sequence struct { ID string `json:"id" bson:"_id,omitempty"` Value int64 `json:"value,omitempty" bson:"value,omitempty"` Customer *Customer }
Sequence ...
func (*Sequence) Collection ¶
Collection get collection
func (*Sequence) MarshalJSON ¶
MarshalJSON ...
func (*Sequence) UnmarshalJSON ¶
UnmarshalJSON ...
type Session ¶
type Session struct { ID primitive.ObjectID `bson:"_id,omitempty"` RoomID primitive.ObjectID `bson:"room_id,omitempty"` CustomerID primitive.ObjectID `bson:"customer_id,omitempty"` UserID primitive.ObjectID `bson:"user_id,omitempty"` Active bool `bson:"active,omitempty"` Peers []string `bson:"peers,omitempty"` Recordings []*SessionRecording `bson:"recordings,omitempty"` CreatedAt time.Time `bson:"created_at,omitempty"` UpdatedAt time.Time `bson:"updated_at,omitempty"` User *User `bson:"-"` Customer *Customer `bson:"-"` Room *Room `bson:"-"` }
Session ...
func (*Session) Collection ¶
Collection model collection
func (*Session) GetCustomer ¶
GetCustomer Get auth session
func (*Session) SetCustomerID ¶
SetCustomerID set id
type SessionList ¶
type SessionList struct {
// contains filtered or unexported fields
}
SessionList ...
type SessionRecording ¶
type SessionRecording struct { Location string `bson:"location,omitempty"` Size int64 `bson:"size,omitempty"` Available bool `bson:"available,omitempty"` Duration time.Duration `bson:"closed,omitempty"` CreatedAt time.Time `bson:"created_at,omitempty"` }
SessionRecording ...
type UploadInfo ¶
type UploadInfo struct { Type string `bson:"type,omitempty"` Location string `json:"location,omitempty"` Prefix string `bson:"prefix,omitempty"` Credentials *Credentials `bson:"credentials,omitempty"` Options map[string]string `bson:"options,omitempty"` }
UploadInfo is Recording info of the room
func (*UploadInfo) UpdateCredentials ¶
func (up *UploadInfo) UpdateCredentials(key, secret string)
UpdateCredentials update crdentials
type User ¶
type User struct { ID primitive.ObjectID `bson:"_id,omitempty"` CustomerID primitive.ObjectID `bson:"customer_id,omitempty"` Name string `bson:"name,omitempty"` Email string `bson:"email,omitempty"` Phone string `bson:"phone,omitempty"` Password string `bson:"password,omitempty"` Active bool `bson:"active,omitempty"` Admin bool `bson:"admin,omitempty"` Roles []string `bson:"roles,omitempty"` CreatedAt time.Time `bson:"created_at,omitempty"` UpdatedAt time.Time `bson:"updated_at,omitempty"` }
User user info
func (*User) GetByEmail ¶
GetByEmail ...
func (*User) VerifyPassword ¶
VerifyPassword ...
type UserList ¶
type UserList struct {
// contains filtered or unexported fields
}
UserList ...