sms

package
v0.0.0-...-c234f5e Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NamedArg

type NamedArg struct {
	Name string
	Val  string
}

type Service

type Service interface {

	// templateArgs 用 []string:
	// - 传入[]string, 不同的平台(ali, tencent)需要转换成对应的类型
	Send(ctx context.Context, templateId string, templateArgs []string, numbers ...string) error
}

type ServiceV1

type ServiceV1 interface {
	// templateArgs 用 any:
	// - 传入的参数可以是任意类型, 但是需要在内部进行类型断言
	// - 调用者需要知道传入的参数类型(!!!)
	SendV1(ctx context.Context, templateId string, templateArgs any, numbers ...string) error
}

type ServiceV2

type ServiceV2 interface {
	// templateArgs 用 []namedArg:
	// - 传入的参数是一个结构体, 里面包含了参数名和参数值
	// - 实现 interface 时方便转成对应的类型
	SendV2(ctx context.Context, templateId string, templateArgs []NamedArg, numbers ...string) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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