models

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Copyright 2019 The OpenPitrix Authors. All rights reserved. Use of this source code is governed by a Apache license that can be found in the LICENSE file.

Index

Constants

View Source
const (
	AddrColId               = "address_id"
	AddrColAddress          = "address"
	AddrColRemarks          = "remarks"
	AddrColVerificationCode = "verification_code"
	AddrColCreateTime       = "create_time"
	AddrColVerifyTime       = "verify_time"
	AddrColStatusTime       = "status_time"
	AddrColNotifyType       = "notify_type"
	AddrColStatus           = "status"
)

field name Addr is short for Address.

View Source
const (
	AddrLsColId         = "address_list_id"
	AddrLsColName       = "address_list_name"
	AddrLsColExtra      = "extra"
	AddrLsColStatus     = "status"
	AddrLsColCreateTime = "create_time"
	AddrLsColStatusTime = "status_time"
)

field name AddrLs is short for AddressList.

View Source
const (
	BindColId         = "binding_id"
	BindColAddrListId = "address_list_id"
	BindColAddrId     = "address_id"
	BindColCreateTime = "create_time"
)

field name Bind is short for AddressListBinding.

View Source
const (
	EmailCfgColProtocol      = "protocol"
	EmailCfgColEmailHost     = "email_host"
	EmailCfgColPort          = "port"
	EmailCfgColDisplaySender = "display_sender"
	EmailCfgColEmail         = "email"
	EmailCfgColPassword      = "password"
	EmailCfgColSSLEnable     = "ssl_enable"
	EmailCfgColCreateTime    = "create_time"
	EmailCfgColStatusTime    = "status_time"
)

field name

View Source
const (
	NFAddrLsColId   = "nf_address_list_id"
	NFAddrLsColLsId = "address_list_id"
	NFAddrLsColNfId = "notification_id"
)

field name NFAddrLs is short for NFAddressList.

View Source
const (
	NfColId           = "notification_id"
	NfColContentType  = "content_type"
	NfColTitle        = "title"
	NfColContent      = "content"
	NfColShortContent = "short_content"
	NfColExpiredDays  = "expired_days"
	NfColAddressInfo  = "address_info"
	NfColOwner        = "owner"
	NfColStatus       = "status"
	NfColCreateTime   = "create_time"
	NfColStatusTime   = "status_time"
)

field name Nf is short for notification.

View Source
const (
	ContentTypeInvite   = "invite"
	ContentTypeVerify   = "verify"
	ContentTypeFee      = "fee"
	ContentTypeBusiness = "business"
	ContentTypeAlerting = "alert"
	ContentTypeOther    = "other"
	ContentTypeEvent    = "event"
)

constants

View Source
const (
	ServiceCfgProtocol     = "protocol"
	ServiceCfgEmailHost    = "email_host"
	ServiceCfgPort         = "port"
	ServiceCfgDisplayEmail = "display_email"
	ServiceCfgEmail        = "email"
	ServiceCfgPassword     = "password"
)
View Source
const (
	ProtocolTypeSMTP = "SMTP"
	ProtocolTypePOP3 = "POP3"
	ProtocolTypeIMAP = "IMAP"
)
View Source
const (
	TaskColNfId       = "notification_id"
	TaskColTaskId     = "task_id"
	TaskColStatus     = "status"
	TaskColErrorCode  = "error_code"
	TaskColCreateTime = "create_time"
)

field name Nf is short for notification.

View Source
const (
	AddressIdPrefix = "addr-"
)
View Source
const (
	AddressListBindingIdPrefix = "bid-"
)
View Source
const (
	AddressListIdPrefix = "adl-"
)
View Source
const (
	NFAddressListIdPrefix = "nfa-"
)
View Source
const (
	NotificationIdPrefix = "nf-"
)

ID Prefix

View Source
const (
	ServiceType = "service_type"
)
View Source
const (
	TableAddress = "address"
)

table name

View Source
const (
	TableAddressList = "address_list"
)

table name

View Source
const (
	TableAddressListBinding = "address_list_binding"
)

table name

View Source
const (
	TableEmailConfig = "email_config"
)

table name

View Source
const (
	TableNFAddressList = "nf_address_list"
)

table name

View Source
const (
	TableNotification = "notification"
)

table name

View Source
const (
	TableTask = "task"
)

table name

View Source
const (
	TaskIdPrefix = "t-"
)
View Source
const (
	WsMessageIdPrefix = "msg-"
)

Variables

columns that can be search through sql '=' operator

columns that can be search through sql 'like' operator

Functions

func AddressListSet2PbSet

func AddressListSet2PbSet(inAddrLists []*AddressList) []*pb.AddressList

func AddressListToPb

func AddressListToPb(addressList *AddressList) *pb.AddressList

func AddressWithListIdSet2PbSet

func AddressWithListIdSet2PbSet(inAddrs []*AddressWithListId) []*pb.Address

func AddressWithListIdToPb

func AddressWithListIdToPb(addressWithListId *AddressWithListId) *pb.Address

func CheckExtra

func CheckExtra(ctx context.Context, extraStr string) error

func DecodeNotificationExtra

func DecodeNotificationExtra(data string) (*map[string]string, error)

func DecodeNotificationExtra4ws

func DecodeNotificationExtra4ws(data string) (ws_service string, ws_message_type string)

func EmailConfigToPb

func EmailConfigToPb(emailConfig *EmailConfig) *pb.EmailServiceConfig

func MessageDetailToPb

func MessageDetailToPb(userMsgDetail *MessageDetail) *pb.MessageDetail

func NewAddressId

func NewAddressId() string

func NewAddressListBindingId

func NewAddressListBindingId() string

func NewAddressListId

func NewAddressListId() string

func NewNFAddressListId

func NewNFAddressListId() string

func NewNotificationId

func NewNotificationId() string

func NewTaskId

func NewTaskId() string

func NewWsMessageId

func NewWsMessageId() string

func NotificationSet2PbSet

func NotificationSet2PbSet(inNfs []*Notification) []*pb.Notification

func NotificationToPb

func NotificationToPb(notification *Notification) *pb.Notification

func TaskSet2PbSet

func TaskSet2PbSet(inTasks []*Task) []*pb.Task

func TaskToPb

func TaskToPb(task *Task) *pb.Task

func UseMsgStringToPb

func UseMsgStringToPb(dataStr string) (*pb.UserMessage, error)

func UserMessageToPb

func UserMessageToPb(userMsg *UserMessage) *pb.UserMessage

Types

type Address

type Address struct {
	AddressId        string    `gorm:"column:address_id"`
	Address          string    `gorm:"column:address"`
	Remarks          string    `gorm:"column:remarks"`
	VerificationCode string    `gorm:"column:verification_code"`
	CreateTime       time.Time `gorm:"column:create_time"`
	VerifyTime       time.Time `gorm:"column:verify_time"`
	StatusTime       time.Time `gorm:"column:status_time"`
	NotifyType       string    `gorm:"column:notify_type"`
	Status           string    `gorm:"column:status"`
}

func NewAddress

func NewAddress(req *pb.CreateAddressRequest) *Address

type AddressInfo

type AddressInfo map[string][]string

func DecodeAddressInfo

func DecodeAddressInfo(data string) (*AddressInfo, error)

type AddressList

type AddressList struct {
	AddressListId   string    `gorm:"column:address_list_id"`
	AddressListName string    `gorm:"column:address_list_name"`
	Extra           string    `gorm:"column:extra"`
	Status          string    `gorm:"column:status"`
	CreateTime      time.Time `gorm:"column:create_time"`
	StatusTime      time.Time `gorm:"column:status_time"`
}

func NewAddressList

func NewAddressList(req *pb.CreateAddressListRequest) *AddressList

type AddressListBinding

type AddressListBinding struct {
	BindingId     string    `gorm:"column:binding_id"`
	AddressListId string    `gorm:"column:address_list_id"`
	AddressId     string    `gorm:"column:address_id"`
	CreateTime    time.Time `gorm:"column:create_time"`
}

type AddressListIds

type AddressListIds []string

func DecodeAddressListIds

func DecodeAddressListIds(data string) (*AddressListIds, error)

type AddressWithListId

type AddressWithListId struct {
	AddressId        string    `gorm:"column:address_id"`
	AddressListId    string    `gorm:"column:address_list_id"`
	Address          string    `gorm:"column:address"`
	Remarks          string    `gorm:"column:remarks"`
	VerificationCode string    `gorm:"column:verification_code"`
	CreateTime       time.Time `gorm:"column:create_time"`
	VerifyTime       time.Time `gorm:"column:verify_time"`
	StatusTime       time.Time `gorm:"column:status_time"`
	NotifyType       string    `gorm:"column:notify_type"`
	Status           string    `gorm:"column:status"`
}

type Content

type Content map[string]string

func DecodeContent

func DecodeContent(data string) (*Content, error)

type EmailConfig

type EmailConfig struct {
	Protocol      string    `gorm:"column:protocol"`
	EmailHost     string    `gorm:"column:email_host"`
	Port          uint32    `gorm:"column:port"`
	DisplaySender string    `gorm:"column:display_sender"`
	Email         string    `gorm:"column:email"`
	Password      string    `gorm:"column:password"`
	SSLEnable     bool      `gorm:"column:ssl_enable"`
	CreateTime    time.Time `gorm:"column:create_time"`
	StatusTime    time.Time `gorm:"column:status_time"`
}

func NewEmailConfig

func NewEmailConfig(req *pb.ServiceConfig) *EmailConfig

type MessageDetail

type MessageDetail struct {
	MessageId      string `json:"ws_message_id,omitempty"`
	UserId         string `json:"ws_user_id,omitempty"`
	Service        string `json:"ws_service,omitempty"`
	MessageType    string `json:"ws_message_type,omitempty"`
	MessageContent string `json:"ws_message,omitempty"`
}

func PbToMessageDetail

func PbToMessageDetail(pbMsgDetail *pb.MessageDetail) *MessageDetail

type NFAddressList

type NFAddressList struct {
	NFAddressListId string `gorm:"column:nf_address_list_id"`
	NotificationId  string `gorm:"column:notification_id"`
	AddressListId   string `gorm:"column:address_list_id"`
}

type Notification

type Notification struct {
	NotificationId     string    `gorm:"column:notification_id"`
	ContentType        string    `gorm:"column:content_type"`
	Title              string    `gorm:"column:title"`
	Content            string    `gorm:"column:content"`
	ShortContent       string    `gorm:"column:short_content"`
	ExpiredDays        uint32    `gorm:"column:expired_days"`
	AddressInfo        string    `gorm:"column:address_info"`
	Owner              string    `gorm:"column:owner"`
	Status             string    `gorm:"column:status"`
	CreateTime         time.Time `gorm:"column:create_time"`
	StatusTime         time.Time `gorm:"column:status_time"`
	AvailableStartTime string    `gorm:"column:available_start_time"`
	AvailableEndTime   string    `gorm:"column:available_end_time"`
	Extra              string    `gorm:"column:extra"`
}

func NewNotification

func NewNotification(req *pb.CreateNotificationRequest) *Notification

type NotificationExtra

type NotificationExtra map[string]string

type Receiver

type Receiver struct {
	Service     string
	MessageType string
	UserId      string
	Conn        *websocket.Conn
}

type Task

type Task struct {
	TaskId         string    `gorm:"column:task_id"`
	NotificationId string    `gorm:"column:notification_id"`
	ErrorCode      int64     `gorm:"column:error_code"`
	Status         string    `gorm:"column:status"`
	CreateTime     time.Time `gorm:"column:create_time"`
	StatusTime     time.Time `gorm:"column:status_time"`
	Directive      string    `gorm:"column:directive"`
	NotifyType     string    `gorm:"column:notify_type"`
}

func NewTask

func NewTask(notificationId, directive string, notifyType string) *Task

type TaskDirective

type TaskDirective struct {
	NotificationId     string
	Address            string
	NotifyType         string
	ContentType        string
	Title              string
	Content            string
	ShortContent       string
	ExpiredDays        uint32
	AvailableStartTime string
	AvailableEndTime   string
}

func DecodeTaskDirective

func DecodeTaskDirective(data string) (*TaskDirective, error)

type TaskWithNfInfo

type TaskWithNfInfo struct {
	NotificationId string
	JobID          string
	TaskID         string
	Title          string
	ShortContent   string
	Content        string
	EmailAddr      string
}

type UserMessage

type UserMessage struct {
	UserId        string `json:"user_id,omitempty"`
	Service       string `json:"service,omitempty"`
	MessageType   string `json:"message_type,omitempty"`
	MessageDetail MessageDetail
}

func PbToUserMessage

func PbToUserMessage(pbUserMsg *pb.UserMessage) *UserMessage

Jump to

Keyboard shortcuts

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