wwgo

package module
v0.0.23 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2021 License: MIT Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const MB = 1 << 20

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 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 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 IntRefSql added in v0.0.2

func IntRefSql(v sql.NullInt32) *int

IntRefSql will return nil for a 'null' SQL string.

func JoinIntArray added in v0.0.8

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

func MigrateCommand

func MigrateCommand(migrator *migrate.Migrate) *cli.Command

func MysqlDbMigrate

func MysqlDbMigrate(db *sqlx.DB, migrations *bindata.AssetSource) (*migrate.Migrate, error)

func NewAwsConfig

func NewAwsConfig(ctx context.Context, log zerolog.Logger) aws.Config

func NewDefaultLogger

func NewDefaultLogger() zerolog.Logger

func OpenDb

func OpenDb(log zerolog.Logger, driverName string, dsn string, maxOpenConns int) (*sqlx.DB, error)

func OpenDbFromWhaleblazer added in v0.0.21

func OpenDbFromWhaleblazer(log zerolog.Logger, maxOpenConns int) (*sqlx.DB, error)

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 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 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 string 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 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 StrRef added in v0.0.2

func StrRef(v string) *string

func StrRefSql added in v0.0.2

func StrRefSql(v sql.NullString) *string

StrRefSql will return nil for a 'null' SQL string.

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 UuidRef added in v0.0.2

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

func WhaleblazerMysqlConfig added in v0.0.21

func WhaleblazerMysqlConfig() (*mysql2.Config, error)

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 ReCaptcha added in v0.0.12

type ReCaptcha struct {
	Log         zerolog.Logger
	SecretKeyV2 string
	SiteKeyV2   string
	SecretKeyV3 string
	SiteKeyV3   string
	MinScoreV3  float32
}

func NewReCaptchaFromEnv added in v0.0.12

func NewReCaptchaFromEnv(log zerolog.Logger) ReCaptcha

func (ReCaptcha) PublicSettings added in v0.0.14

func (r ReCaptcha) PublicSettings() ReCaptchaPublicSettings

func (ReCaptcha) ReCaptchaV2Verify added in v0.0.12

func (r ReCaptcha) ReCaptchaV2Verify(ctx context.Context, token string) (*ReCaptchaV2Response, error)

func (ReCaptcha) ReCaptchaV3Verify added in v0.0.12

func (r ReCaptcha) ReCaptchaV3Verify(ctx context.Context, token string) (*ReCaptchaV3Response, error)

func (ReCaptcha) VerifyReCaptchaTokensFromContext added in v0.0.12

func (r ReCaptcha) VerifyReCaptchaTokensFromContext(ctx context.Context, action string, tokens ReCaptchaTokens) error

type ReCaptchaPublicSettings added in v0.0.14

type ReCaptchaPublicSettings struct {
	SiteKeyV2 string `json:"siteKeyV2"`
	SiteKeyV3 string `json:"siteKeyV3"`
}

type ReCaptchaTokens added in v0.0.12

type ReCaptchaTokens struct {
	ReCaptchaV3token *string
	ReCaptchaV2token *string
}

type ReCaptchaV2Response added in v0.0.12

type ReCaptchaV2Response struct {
	Success     bool     `json:"success"`
	ChallengeTs string   `json:"challenge_ts"`
	Hostname    string   `json:"hostname"`
	ErrorCodes  []string `json:"error-codes"`
}

type ReCaptchaV3Response added in v0.0.12

type ReCaptchaV3Response struct {
	Success     bool     `json:"success"`
	Score       float32  `json:"score"`
	Action      string   `json:"action"`
	ChallengeTs string   `json:"challenge_ts"`
	Hostname    string   `json:"hostname"`
	ErrorCodes  []string `json:"error-codes"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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