models

package
v1.0.0-beta7 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Private    RoomType = "private"
	Group      RoomType = "group"
	SuperGroup RoomType = "supergroup"
	Channel    RoomType = "channel"

	BeEdited           RoomPermission = "be_edited"
	ManageChat         RoomPermission = "manage_chat"
	PostMessages       RoomPermission = "post_messages"
	EditMessages       RoomPermission = "edit_messages"
	DeleteMessages     RoomPermission = "delete_messages"
	ManageVoiceChats   RoomPermission = "manage_voice_chats"
	RestrictMembers    RoomPermission = "restrict_members"
	PromoteMembers     RoomPermission = "promote_members"
	ChangeInfo         RoomPermission = "change_info"
	InviteUsers        RoomPermission = "invite_users"
	PinMessages        RoomPermission = "pin_messages"
	SendMessages       RoomPermission = "send_messages"
	SendMediaMessages  RoomPermission = "send_media_messages"
	SendPolls          RoomPermission = "send_polls"
	SendOtherMessages  RoomPermission = "send_other_messages"
	AddWebPagePreviews RoomPermission = "add_web_page_previews"
)
View Source
const (
	Google   Provider = "GOOGLE"
	Facebook Provider = "FACEBOOK"
	Linkedin Provider = "LINKEDIN"
	GitHub   Provider = "GITHUB"

	AdminRole Role = "ROLE_ADMIN"
	UserRole  Role = "ROLE_USER"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Feed

type Feed struct {
	Id        string    `json:"id,omitempty" bson:"_id,omitempty"`
	By        int64     `json:"by,omitempty" bson:"by,omitempty"`
	Languages []string  `json:"languages,omitempty" bson:"languages,omitempty"`
	Host      string    `json:"host,omitempty" bson:"host,omitempty"`
	Title     string    `json:"title,omitempty" bson:"title,omitempty"`
	Link      string    `json:"link,omitempty" bson:"link,omitempty"`
	Enabled   *bool     `json:"enabled,omitempty" bson:"enabled,omitempty"`
	CreatedAt time.Time `json:"created_at,omitempty" bson:"created_at,omitempty"`
	UpdatedAt time.Time `json:"updated_at,omitempty" bson:"updated_at,omitempty"`
}

func (*Feed) SetEnabled

func (r *Feed) SetEnabled(enabled bool) *Feed
func (r *Feed) SetLink(link string) *Feed

type FeedItem

type FeedItem struct {
	Id         string    `json:"id,omitempty" bson:"_id,omitempty"`
	FeedId     string    `json:"feed_id,omitempty" bson:"feed_id,omitempty"`
	Title      string    `json:"title,omitempty" bson:"title,omitempty"`
	Desc       *string   `json:"desc,omitempty" bson:"desc,omitempty"`
	Link       string    `json:"link,omitempty" bson:"link,omitempty"`
	Guid       string    `json:"guid,omitempty" bson:"guid,omitempty"`
	PubDate    time.Time `json:"pub_date,omitempty" bson:"pub_date,omitempty"`
	CreatedAt  time.Time `json:"created_at,omitempty" bson:"created_at,omitempty"`
	UpdatedAt  time.Time `json:"updated_at,omitempty" bson:"updated_at,omitempty"`
	Authors    []string  `json:"authors,omitempty" bson:"authors,omitempty"`
	Categories []string  `json:"categories,omitempty" bson:"categories,omitempty"`
}

func (*FeedItem) Domain

func (i *FeedItem) Domain() string

func (*FeedItem) SetDesc

func (i *FeedItem) SetDesc(desc string) *FeedItem

type Provider

type Provider string

type ProviderData

type ProviderData struct {
	Name   Provider `json:"name,omitempty" bson:"name,omitempty"`
	Value  string   `json:"value,omitempty" bson:"value,omitempty"`
	Delete bool     `json:"-" bson:"-"`
}

func (*ProviderData) Is

func (p *ProviderData) Is(provider Provider) bool

type Role

type Role string

type Room

type Room struct {
	Id          int64             `json:"id,omitempty" bson:"_id,omitempty"`
	Type        RoomType          `json:"type,omitempty" bson:"type,omitempty"`
	Title       string            `json:"title,omitempty" bson:"title,omitempty"`
	UserName    string            `json:"username,omitempty" bson:"username,omitempty"`
	FirstName   string            `json:"first_name,omitempty" bson:"first_name,omitempty"`
	LastName    string            `json:"last_name,omitempty" bson:"last_name,omitempty"`
	Broadcast   *[]string         `json:"broadcast,omitempty" bson:"broadcast,omitempty"`
	Permissions *[]RoomPermission `json:"permissions,omitempty" bson:"permissions,omitempty"`
	Deleted     *bool             `json:"deleted,omitempty" bson:"deleted,omitempty"`
	CreatedAt   time.Time         `json:"created_at,omitempty" bson:"created_at,omitempty"`
	UpdatedAt   time.Time         `json:"updated_at,omitempty" bson:"updated_at,omitempty"`
}

func (*Room) IsDeleted

func (r *Room) IsDeleted() bool

func (*Room) SetBroadcast

func (r *Room) SetBroadcast(broadcast []string) *Room

func (*Room) SetDeleted

func (r *Room) SetDeleted(deleted bool) *Room

func (*Room) SetPermissions

func (r *Room) SetPermissions(permissions []RoomPermission) *Room

type RoomPermission

type RoomPermission string

type RoomType

type RoomType string

type User

type User struct {
	Id          string         `json:"id,omitempty" bson:"_id,omitempty"`
	Username    string         `json:"username,omitempty" bson:"username,omitempty"`
	Email       string         `json:"email,omitempty" bson:"email,omitempty"`
	Password    string         `json:"-" bson:"password,omitempty"`
	OTPSecret   []byte         `json:"-" bson:"otp_secret,omitempty"`
	Roles       []Role         `json:"roles,omitempty" bson:"roles,omitempty"`
	DeleteRoles []Role         `json:"-" bson:"-"`
	Providers   []ProviderData `json:"providers,omitempty" bson:"providers,omitempty"`
	CreatedAt   time.Time      `json:"created_at,omitempty" bson:"created_at,omitempty"`
	UpdatedAt   time.Time      `json:"updated_at,omitempty" bson:"updated_at,omitempty"`
}

func (*User) CheckPassword

func (u *User) CheckPassword(password string) error

func (*User) CheckTOTP

func (u *User) CheckTOTP(password string) error

func (*User) GenerateOTPSecret

func (u *User) GenerateOTPSecret(size uint) (err error)

func (*User) GeneratePasswordHash

func (u *User) GeneratePasswordHash() error

func (*User) HasPassword

func (u *User) HasPassword() bool

func (*User) HasProvider

func (u *User) HasProvider(provider Provider) bool

func (*User) IsGranted

func (u *User) IsGranted(roles ...Role) bool

func (*User) Secret

func (u *User) Secret() string

Jump to

Keyboard shortcuts

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