Documentation ¶
Index ¶
- func ArrayDiffInt(a []int, b []int) []int
- func ArrayDiffInt32(a []int32, b []int32) []int32
- func ArrayDiffStr(a []string, b []string) []string
- func ArrayDiffUuid(a []uuid.UUID, b []uuid.UUID) []uuid.UUID
- func ArrayDiffUuidRef(a []*uuid.UUID, b []*uuid.UUID) []*uuid.UUID
- func ArrayFillStr(value string, count int) []string
- func ArrayFilterAndJoinStr(a []string, sep string) string
- func ArrayFilterFnStr(a []string, fn func(v string) bool) []string
- func ArrayFilterStr(a []string) []string
- func ArrayIncludesInt(haystack []int, needle int) bool
- func ArrayIncludesInt32(haystack []int32, needle int32) bool
- func ArrayIncludesStr(haystack []string, needle string) bool
- func ArrayIncludesUUID(haystack []uuid.UUID, needle uuid.UUID) bool
- func ArrayMapStr(a []string, fn func(v string) string) []string
- func BoolFromSqlTinyInt(v int8) bool
- func BoolRef(v bool) *bool
- func CliAsk(question string, defaultAnswer string) string
- func CliAskPassword(question string) string
- func CliAskRequired(question string, defaultAnswer string) string
- func CliConfirm(question string) bool
- func DecimalRef(v decimal.Decimal) *decimal.Decimal
- func DecimalRefFromSql(v decimal.NullDecimal) *decimal.Decimal
- func FormatDate(t time.Time, format string) string
- func GenerateRandomKey(length int) []byte
- func GenerateRandomString(length int, charset []rune) string
- func GqlTime(v time.Time) string
- func GqlTimeRefSql(v sql.NullTime) *string
- func Int32MustParse(v string) int32
- func Int32Ref(v int32) *int32
- func Int64MustParse(v string) int64
- func Int64Ref(v int64) *int64
- func IntArray2StrArray(in []int) []string
- func IntRef(v int) *int
- func IntRefFromSql(v sql.NullInt32) *int
- func JoinIntArray(in []int, sep string) string
- func NewDefaultLogger() zerolog.Logger
- func Plural(count int, singular string, plural string) string
- func PrintErrWithStack(err error)
- func RenderTemplatePlain(tplStr string, data interface{}) (string, error)
- func SendSlackWebhook(ctx context.Context, webhookUrl string, message SlackMessagePayload) error
- func SqlNullDecimalRef(v *decimal.Decimal) decimal.NullDecimal
- func SqlNullInt32(v int32) sql.NullInt32
- func SqlNullIntRef(v *int) sql.NullInt32
- func SqlNullStr(v string) sql.NullString
- func SqlNullStrRef(v *string) sql.NullString
- func SqlNullTime(v time.Time) sql.NullTime
- func SqlNullTimeRef(v *time.Time) sql.NullTime
- func SqlNullUuid(v uuid.UUID) uuid.NullUUID
- func SqlNullUuidRef(v *uuid.UUID) uuid.NullUUID
- func SqlTimeToStrRef(v sql.NullTime) *string
- func SqlTinyIntFromBool(v bool) int8
- func StrFromRef(v *string) string
- func StrNilIfEmpty(v string) *string
- func StrRef(v string) *string
- func StrRefFromSql(v sql.NullString) *string
- func StrSliceToStrRefSlice(v []string) []*string
- func TimeFromGqlTime(v string) (time.Time, error)
- func TimeRef(v time.Time) *time.Time
- func TimeRefFromGqlTimeRef(v *string) *time.Time
- func TimeRefFromSql(v sql.NullTime) *time.Time
- func TruncateStr(str string, maxLen int) string
- func TruncateStrBytes(str string, maxBytes int) string
- func UuidRef(id uuid.UUID) *uuid.UUID
- func UuidRefFromSql(v uuid.NullUUID) *uuid.UUID
- type ClientError
- type SlackMessagePayload
- type SlackWebhookClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArrayDiffInt ¶ added in v0.0.7
ArrayDiffInt returns a slice of all values from a that are not in b.
func ArrayDiffInt32 ¶ added in v0.0.2
ArrayDiffInt32 returns a slice of all values from a that are not in b.
func ArrayDiffStr ¶ added in v0.0.2
ArrayDiffStr returns a slice of all values from a that are not in b.
func ArrayDiffUuid ¶ added in v0.2.6
ArrayDiffUuid returns a slice of all values from a that are not in b.
func ArrayDiffUuidRef ¶ added in v0.2.6
ArrayDiffUuidRef returns a slice of all values from a that are not in b.
func ArrayFillStr ¶ added in v0.0.2
func ArrayFilterAndJoinStr ¶ added in v0.0.2
func ArrayFilterFnStr ¶ added in v0.0.2
func ArrayFilterStr ¶ added in v0.0.2
func ArrayIncludesInt ¶ added in v0.0.2
func ArrayIncludesInt32 ¶ added in v0.0.2
func ArrayIncludesStr ¶ added in v0.0.2
func ArrayIncludesUUID ¶ added in v0.0.2
func BoolFromSqlTinyInt ¶ added in v0.0.2
func CliAskPassword ¶
func CliAskRequired ¶
func CliConfirm ¶
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
FormatDate supports ordinal days.
func GenerateRandomKey ¶ added in v0.0.2
func GenerateRandomString ¶ added in v0.0.2
func GqlTimeRefSql ¶ added in v0.0.2
func Int32MustParse ¶ added in v0.0.2
func Int64MustParse ¶ added in v0.0.2
func IntArray2StrArray ¶ added in v0.0.8
func IntRefFromSql ¶ added in v0.2.0
IntRefFromSql will return nil for a 'null' SQL value.
func JoinIntArray ¶ added in v0.0.8
func NewDefaultLogger ¶
func PrintErrWithStack ¶
func PrintErrWithStack(err error)
func RenderTemplatePlain ¶ added in v0.0.2
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
SqlNullInt32 will return a sql 'null' value if the value is 0.
func SqlNullIntRef ¶ added in v0.1.3
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
SqlNullTime will return a sql 'null' value if the time is 0.
func SqlNullTimeRef ¶ added in v0.2.0
SqlNullTimeRef will return a sql 'null' value if the pointer is nil.
func SqlNullUuid ¶ added in v0.1.5
SqlNullUuid will return a sql 'null' value if the uuid is empty.
func SqlNullUuidRef ¶ added in v0.1.5
SqlNullUuidRef will return a sql 'null' value if the pointer is nil.
func SqlTimeToStrRef ¶ added in v0.0.2
func SqlTinyIntFromBool ¶ added in v0.0.2
func StrFromRef ¶ added in v0.0.2
func StrNilIfEmpty ¶ added in v0.2.4
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 TimeRefFromGqlTimeRef ¶ added in v0.0.2
func TimeRefFromSql ¶ added in v0.2.0
TimeRefFromSql will return nil for a 'null' SQL value.
func TruncateStr ¶ added in v0.6.7
TruncateStr multibyte/UTF-8 safe truncate to a maximum number of characters.
func TruncateStrBytes ¶ added in v0.6.7
TruncateStrBytes multibyte/UTF-8 safe truncate to a maximum number of bytes.
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 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)