wwgo

package module
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2022 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayDiffInt added in v0.0.7

func ArrayDiffInt(a []int, b []int) []int

ArrayDiffInt returns a slice of all values from a that are not in b.

func ArrayDiffInt32 added in v0.0.2

func ArrayDiffInt32(a []int32, b []int32) []int32

ArrayDiffInt32 returns a slice of all values from a that are not in b.

func ArrayDiffStr added in v0.0.2

func ArrayDiffStr(a []string, b []string) []string

ArrayDiffStr returns a slice of all values from a that are not in b.

func ArrayDiffUuid added in v0.2.6

func ArrayDiffUuid(a []uuid.UUID, b []uuid.UUID) []uuid.UUID

ArrayDiffUuid returns a slice of all values from a that are not in b.

func ArrayDiffUuidRef added in v0.2.6

func ArrayDiffUuidRef(a []*uuid.UUID, b []*uuid.UUID) []*uuid.UUID

ArrayDiffUuidRef returns a slice of all values from a that are not in b.

func ArrayFillStr added in v0.0.2

func ArrayFillStr(value string, count int) []string

func ArrayFilterAndJoinStr added in v0.0.2

func ArrayFilterAndJoinStr(a []string, sep string) string

func ArrayFilterFnStr added in v0.0.2

func ArrayFilterFnStr(a []string, fn func(v string) bool) []string

func ArrayFilterStr added in v0.0.2

func ArrayFilterStr(a []string) []string

func ArrayIncludesInt added in v0.0.2

func ArrayIncludesInt(haystack []int, needle int) bool

func ArrayIncludesInt32 added in v0.0.2

func ArrayIncludesInt32(haystack []int32, needle int32) bool

func ArrayIncludesStr added in v0.0.2

func ArrayIncludesStr(haystack []string, needle string) bool

func ArrayIncludesUUID added in v0.0.2

func ArrayIncludesUUID(haystack []uuid.UUID, needle uuid.UUID) bool

func ArrayMapStr added in v0.0.2

func ArrayMapStr(a []string, fn func(v string) string) []string

func BoolFromSqlTinyInt added in v0.0.2

func BoolFromSqlTinyInt(v int8) bool

func BoolRef added in v0.0.2

func BoolRef(v bool) *bool

func CliAsk

func CliAsk(question string, defaultAnswer string) string

func CliAskPassword

func CliAskPassword(question string) string

func CliAskRequired

func CliAskRequired(question string, defaultAnswer string) string

func CliConfirm

func CliConfirm(question string) bool

func DecimalRef added in v0.1.3

func DecimalRef(v decimal.Decimal) *decimal.Decimal

func DecimalRefFromSql added in v0.2.0

func DecimalRefFromSql(v decimal.NullDecimal) *decimal.Decimal

DecimalRefFromSql will return nil for a 'null' SQL value.

func FormatDate added in v0.0.2

func FormatDate(t time.Time, format string) string

FormatDate supports ordinal days.

func GenerateRandomKey added in v0.0.2

func GenerateRandomKey(length int) []byte

func GenerateRandomString added in v0.0.2

func GenerateRandomString(length int, charset []rune) string

func GqlTime added in v0.0.2

func GqlTime(v time.Time) string

func GqlTimeRefSql added in v0.0.2

func GqlTimeRefSql(v sql.NullTime) *string

func Int32MustParse added in v0.0.2

func Int32MustParse(v string) int32

func Int32Ref added in v0.0.2

func Int32Ref(v int32) *int32

func Int64MustParse added in v0.0.2

func Int64MustParse(v string) int64

func Int64Ref added in v0.0.2

func Int64Ref(v int64) *int64

func IntArray2StrArray added in v0.0.8

func IntArray2StrArray(in []int) []string

func IntRef added in v0.0.2

func IntRef(v int) *int

func IntRefFromSql added in v0.2.0

func IntRefFromSql(v sql.NullInt32) *int

IntRefFromSql will return nil for a 'null' SQL value.

func JoinIntArray added in v0.0.8

func JoinIntArray(in []int, sep string) string

func NewDefaultLogger

func NewDefaultLogger() zerolog.Logger

func Plural added in v0.0.3

func Plural(count int, singular string, plural string) string

func PrintErrWithStack

func PrintErrWithStack(err error)

func RenderTemplatePlain added in v0.0.2

func RenderTemplatePlain(tplStr string, data interface{}) (string, error)

func SendSlackWebhook added in v0.6.4

func SendSlackWebhook(ctx context.Context, webhookUrl string, message SlackMessagePayload) error

func SqlNullDecimalRef added in v0.2.0

func SqlNullDecimalRef(v *decimal.Decimal) decimal.NullDecimal

SqlNullDecimalRef will return a sql 'null' value if the pointer is nil.

func SqlNullInt32 added in v0.0.2

func SqlNullInt32(v int32) sql.NullInt32

SqlNullInt32 will return a sql 'null' value if the value is 0.

func SqlNullIntRef added in v0.1.3

func SqlNullIntRef(v *int) sql.NullInt32

SqlNullIntRef will return a sql 'null' value if the pointer is nil.

func SqlNullStr added in v0.0.2

func SqlNullStr(v string) sql.NullString

SqlNullStr will return a sql 'null' value if the string is empty.

func SqlNullStrRef added in v0.0.2

func SqlNullStrRef(v *string) sql.NullString

SqlNullStrRef will return a sql 'null' value if the pointer is nil.

func SqlNullTime added in v0.0.2

func SqlNullTime(v time.Time) sql.NullTime

SqlNullTime will return a sql 'null' value if the time is 0.

func SqlNullTimeRef added in v0.2.0

func SqlNullTimeRef(v *time.Time) sql.NullTime

SqlNullTimeRef will return a sql 'null' value if the pointer is nil.

func SqlNullUuid added in v0.1.5

func SqlNullUuid(v uuid.UUID) uuid.NullUUID

SqlNullUuid will return a sql 'null' value if the uuid is empty.

func SqlNullUuidRef added in v0.1.5

func SqlNullUuidRef(v *uuid.UUID) uuid.NullUUID

SqlNullUuidRef will return a sql 'null' value if the pointer is nil.

func SqlTimeToStrRef added in v0.0.2

func SqlTimeToStrRef(v sql.NullTime) *string

func SqlTinyIntFromBool added in v0.0.2

func SqlTinyIntFromBool(v bool) int8

func StrFromRef added in v0.0.2

func StrFromRef(v *string) string

func StrNilIfEmpty added in v0.2.4

func StrNilIfEmpty(v string) *string

func StrRef added in v0.0.2

func StrRef(v string) *string

func StrRefFromSql added in v0.2.0

func StrRefFromSql(v sql.NullString) *string

StrRefFromSql will return nil for a 'null' SQL value.

func StrSliceToStrRefSlice added in v0.0.2

func StrSliceToStrRefSlice(v []string) []*string

func TimeFromGqlTime added in v0.0.2

func TimeFromGqlTime(v string) (time.Time, error)

func TimeRef added in v0.0.2

func TimeRef(v time.Time) *time.Time

func TimeRefFromGqlTimeRef added in v0.0.2

func TimeRefFromGqlTimeRef(v *string) *time.Time

func TimeRefFromSql added in v0.2.0

func TimeRefFromSql(v sql.NullTime) *time.Time

TimeRefFromSql will return nil for a 'null' SQL value.

func TruncateStr added in v0.6.7

func TruncateStr(str string, maxLen int) string

TruncateStr multibyte/UTF-8 safe truncate to a maximum number of characters.

func TruncateStrBytes added in v0.6.7

func TruncateStrBytes(str string, maxBytes int) string

TruncateStrBytes multibyte/UTF-8 safe truncate to a maximum number of bytes.

func UuidRef added in v0.0.2

func UuidRef(id uuid.UUID) *uuid.UUID

func UuidRefFromSql added in v0.2.5

func UuidRefFromSql(v uuid.NullUUID) *uuid.UUID

UuidRefFromSql will return nil for a 'null' SQL value.

Types

type ClientError added in v0.0.6

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

ClientError represents an error that should be displayed to the user.

func NewClientError added in v0.0.6

func NewClientError(code string, message string, err error) *ClientError

func (*ClientError) Error added in v0.0.6

func (err *ClientError) Error() string

func (*ClientError) GqlErrorCode added in v0.0.6

func (err *ClientError) GqlErrorCode() string

func (*ClientError) StackTrace added in v0.0.6

func (err *ClientError) StackTrace() errors.StackTrace

func (*ClientError) Unwrap added in v0.0.6

func (err *ClientError) Unwrap() error

type SlackMessagePayload added in v0.6.4

type SlackMessagePayload struct {
	Channel   *string `json:"channel"`
	Username  *string `json:"username"`
	Text      string  `json:"text"`
	IconEmoji *string `json:"icon_emoji"`
}

type SlackWebhookClient added in v0.6.4

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

func NewSlackWebhookClientFromEnv added in v0.6.4

func NewSlackWebhookClientFromEnv(log zerolog.Logger) *SlackWebhookClient

func (*SlackWebhookClient) Send added in v0.6.4

func (s *SlackWebhookClient) Send(ctx context.Context, message SlackMessagePayload)

Directories

Path Synopsis
tools

Jump to

Keyboard shortcuts

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