jiguang

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2024 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const LogPrefix = "[JGSDK] "

Variables

View Source
var ModPathRegex = regexp.MustCompile(`github\.com/[^@]+(@[^/]+)?/.+`) // 匹配模块路径

Functions

func Bool

func Bool(v bool) *bool

Bool is a helper routine that allocates a new bool value to store v and returns a pointer to it.

func Float32

func Float32(v float32) *float32

Float32 is a helper routine that allocates a new float32 value to store v and returns a pointer to it.

func Float64

func Float64(v float64) *float64

Float64 is a helper routine that allocates a new float64 value to store v and returns a pointer to it.

func Int

func Int(v int) *int

Int is a helper routine that allocates a new int value to store v and returns a pointer to it.

func Int16

func Int16(v int16) *int16

Int16 is a helper routine that allocates a new int16 value to store v and returns a pointer to it.

func Int32

func Int32(v int32) *int32

Int32 is a helper routine that allocates a new int32 value to store v and returns a pointer to it.

func Int64

func Int64(v int64) *int64

Int64 is a helper routine that allocates a new int64 value to store v and returns a pointer to it.

func Int8

func Int8(v int8) *int8

Int8 is a helper routine that allocates a new int8 value to store v and returns a pointer to it.

func String

func String(v string) *string

String is a helper routine that allocates a new string value to store v and returns a pointer to it.

func Uint

func Uint(v uint) *uint

Uint is a helper routine that allocates a new uint value to store v and returns a pointer to it.

func Uint16

func Uint16(v uint16) *uint16

Uint16 is a helper routine that allocates a new uint16 value to store v and returns a pointer to it.

func Uint32

func Uint32(v uint32) *uint32

Uint32 is a helper routine that allocates a new uint32 value to store v and returns a pointer to it.

func Uint64

func Uint64(v uint64) *uint64

Uint64 is a helper routine that allocates a new uint64 value to store v and returns a pointer to it.

func Uint8

func Uint8(v uint8) *uint8

Uint8 is a helper routine that allocates a new uint8 value to store v and returns a pointer to it.

Types

type LocalDate

type LocalDate localTime

func BuildLocalDate

func BuildLocalDate(year, month, day int) LocalDate

func LocalDateNow

func LocalDateNow() LocalDate

func ParseLocalDate

func ParseLocalDate(ds string) (LocalDate, error)

func (LocalDate) Format

func (t LocalDate) Format() string

func (LocalDate) MarshalJSON

func (t LocalDate) MarshalJSON() ([]byte, error)

func (LocalDate) String

func (t LocalDate) String() string

func (LocalDate) ToUnitTime

func (t LocalDate) ToUnitTime() UnitTime

func (*LocalDate) UnmarshalJSON

func (t *LocalDate) UnmarshalJSON(data []byte) error

type LocalDateTime

type LocalDateTime localTime

func BuildLocalDateTime

func BuildLocalDateTime(year, month, day, hour, min, sec int) LocalDateTime

func LocalDateTimeNow

func LocalDateTimeNow() LocalDateTime

func ParseLocalDateTime

func ParseLocalDateTime(dts string) (LocalDateTime, error)

func (LocalDateTime) Format

func (t LocalDateTime) Format() string

func (LocalDateTime) MarshalJSON

func (t LocalDateTime) MarshalJSON() ([]byte, error)

func (LocalDateTime) String

func (t LocalDateTime) String() string

func (*LocalDateTime) UnmarshalJSON

func (t *LocalDateTime) UnmarshalJSON(data []byte) error

type LocalTime

type LocalTime localTime

func BuildLocalTime

func BuildLocalTime(hour, min, sec int) LocalTime

func LocalTimeNow

func LocalTimeNow() LocalTime

func ParseLocalTime

func ParseLocalTime(ts string) (LocalTime, error)

func (LocalTime) Format

func (t LocalTime) Format() string

func (LocalTime) FormatUsingTimeUnit

func (t LocalTime) FormatUsingTimeUnit(tu TimeUnit) string

func (LocalTime) MarshalJSON

func (t LocalTime) MarshalJSON() ([]byte, error)

func (LocalTime) String

func (t LocalTime) String() string

func (*LocalTime) UnmarshalJSON

func (t *LocalTime) UnmarshalJSON(data []byte) error

type Logger

type Logger interface {
	Debug(ctx context.Context, msg string)
	Info(ctx context.Context, msg string)
	Warn(ctx context.Context, msg string)
	Error(ctx context.Context, msg string)

	Debugf(ctx context.Context, format string, args ...interface{})
	Infof(ctx context.Context, format string, args ...interface{})
	Warnf(ctx context.Context, format string, args ...interface{})
	Errorf(ctx context.Context, format string, args ...interface{})
}

Logger 是 SDK 使用的日志记录器的接口。

type StdLogger

type StdLogger struct {
	// contains filtered or unexported fields
}

StdLogger 使用标准库的 log 包实现了 Logger 接口。

func NewStdLogger

func NewStdLogger() *StdLogger

func (*StdLogger) Debug

func (s *StdLogger) Debug(ctx context.Context, msg string)

func (*StdLogger) Debugf

func (s *StdLogger) Debugf(ctx context.Context, format string, args ...interface{})

func (*StdLogger) Error

func (s *StdLogger) Error(ctx context.Context, msg string)

func (*StdLogger) Errorf

func (s *StdLogger) Errorf(ctx context.Context, format string, args ...interface{})

func (*StdLogger) Info

func (s *StdLogger) Info(ctx context.Context, msg string)

func (*StdLogger) Infof

func (s *StdLogger) Infof(ctx context.Context, format string, args ...interface{})

func (*StdLogger) Warn

func (s *StdLogger) Warn(ctx context.Context, msg string)

func (*StdLogger) Warnf

func (s *StdLogger) Warnf(ctx context.Context, format string, args ...interface{})

type Time

type Time interface {
	Format() string
}

type TimeUnit

type TimeUnit string

时间单位

const (
	TimeUnitHour  TimeUnit = "HOUR"  // 小时 HOUR,任务执行点 Point 无效!
	TimeUnitDay   TimeUnit = "DAY"   // 天 DAY,任务执行点 Point 无效!
	TimeUnitWeek  TimeUnit = "WEEK"  // 周 WEEK,任务执行点 Point 的取值范围为 [MON, TUE, WED, THU, FRI, SAT, SUN]。
	TimeUnitMonth TimeUnit = "MONTH" // 月 MONTH,任务执行点 Point 的取值范围为 [01, 02, 03, ......, 31]。
)

func (TimeUnit) Format

func (tu TimeUnit) Format(st time.Time) string

func (TimeUnit) IsValid

func (tu TimeUnit) IsValid() bool

func (TimeUnit) Layout

func (tu TimeUnit) Layout() string

func (TimeUnit) MarshalJSON

func (tu TimeUnit) MarshalJSON() ([]byte, error)

func (TimeUnit) String

func (tu TimeUnit) String() string

func (*TimeUnit) UnmarshalJSON

func (tu *TimeUnit) UnmarshalJSON(data []byte) error

type UnitTime

type UnitTime struct {
	time.Time
	TimeUnit
}

UnitTime 组合了 time.Time 及 jiguang.TimeUnit。

func (UnitTime) Format

func (ut UnitTime) Format() string

func (UnitTime) MarshalJSON

func (ut UnitTime) MarshalJSON() ([]byte, error)

func (UnitTime) String

func (ut UnitTime) String() string

func (UnitTime) ToLocalDate

func (ut UnitTime) ToLocalDate() LocalDate

func (UnitTime) ToLocalDateTime

func (ut UnitTime) ToLocalDateTime() LocalDateTime

func (UnitTime) ToLocalTime

func (ut UnitTime) ToLocalTime() LocalTime

func (*UnitTime) UnmarshalJSON

func (ut *UnitTime) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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