utils

package
v0.0.1-alpha Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Username 用户名
	Username core.SubjectMark = iota
	// Email 电子邮箱
	Email
	// MailSubject 邮件主题
	MailSubject
)

Variables

This section is empty.

Functions

func Accept

func Accept(src core.ContentType, targets ...core.ContentType) bool

Accept 判断指定的 src 在 targets 上是否可以被接受

func AcceptInput

func AcceptInput(component core.ManyInputLimit, targetType core.ContentType) bool

AcceptInput 判断指定的多输入类型组件是否可以接受目标类型

func AcceptOutput

func AcceptOutput(component core.ManyOutputLimit, targetType core.ContentType) bool

AcceptOutput 判断指定的多输出类型组件是否可以接受目标类型

func BuildTextContentByBytes

func BuildTextContentByBytes(data []byte, charset string) core.TextContent

BuildTextContentByBytes 通过字节数组构建 TextContent 对象

func BuildTextContentByStr

func BuildTextContentByStr(text string) core.TextContent

BuildTextContentByStr 通过字符串构建 TextContent 对象

func DefaultSubject

func DefaultSubject() core.Subject

DefaultSubject 创建一个默认大小的 Subject 对象

func LimitType

func LimitType(types ...core.ContentType) []core.ContentType

LimitType 构建类型限定数组

func NewSubject

func NewSubject(size int) core.Subject

NewSubject 创建一个默认的 Subject 对象

Types

type BytesTextContent

type BytesTextContent struct {
	// 内容体
	Data []byte
	// 字符编码
	Charset string
}

BytesTextContent 字节数组型文本内容模型

func (BytesTextContent) Bytes

func (content BytesTextContent) Bytes() []byte

Bytes 返回内容的 Byte 数组表现形式

func (BytesTextContent) GetCharset

func (content BytesTextContent) GetCharset() string

func (BytesTextContent) GetText

func (content BytesTextContent) GetText() string

func (BytesTextContent) GetType

func (content BytesTextContent) GetType() core.ContentType

GetType 获取内容类型

func (BytesTextContent) String

func (content BytesTextContent) String() string

重写 String() 方法

type StringContent

type StringContent struct {
	// 内容体
	Text string
}

StringContent 字符串型文本内容模型

func (StringContent) Bytes

func (content StringContent) Bytes() []byte

Bytes 返回内容的 Byte 数组表现形式

func (StringContent) GetCharset

func (content StringContent) GetCharset() string

GetCharset 获取该文本的字符编码

func (StringContent) GetText

func (content StringContent) GetText() string

GetText 获取文本内容

func (StringContent) GetType

func (content StringContent) GetType() core.ContentType

GetType 获取内容类型

func (StringContent) String

func (content StringContent) String() string

重写 String() 方法

Jump to

Keyboard shortcuts

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