utils

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2017 License: MIT Imports: 17 Imported by: 16

Documentation

Index

Constants

View Source
const (
	APP_NAME      = "swagchat-api"
	API_VERSION   = "v0"
	BUILD_VERSION = "v0.4.0"
)

Variables

View Source
var (
	Cfg           *Config
	IsShowVersion bool
)
View Source
var AppLogger *zap.Logger

Functions

func AppendStrings

func AppendStrings(strings ...string) string

func CreateUuid

func CreateUuid() string

func IsUrl

func IsUrl(checkUrl string) error

func IsValidId

func IsValidId(id string) bool

func Join

func Join(stringSlice []string, delimiter string, enclosure string) string

func MakePrepareForInExpression

func MakePrepareForInExpression(target interface{}) (string, map[string]interface{})

func MergeMap

func MergeMap(baseMap map[string]interface{}, mergeMaps ...map[string]interface{}) map[string]interface{}

func RemoveDuplicate

func RemoveDuplicate(args []string) []string

func SearchStringValueInSlice added in v0.2.0

func SearchStringValueInSlice(slice []string, value string) bool

Types

type Config

type Config struct {
	Version        string
	Port           string
	Profiling      bool
	ErrorLogging   bool `yaml:"errorLogging"`
	Logging        *Logging
	Storage        *Storage
	Datastore      *Datastore
	Messaging      *Messaging
	Notification   *Notification
	RealtimeServer *RealtimeServer `yaml:"realtimeServer"`
}

type Datastore added in v0.4.0

type Datastore struct {
	Provider        string
	TableNamePrefix string `yaml:"tableNamePrefix"`

	// SQLite
	SqlitePath string `yaml:"sqlitePath"`

	// MySQL, GCP SQL
	User              string
	Password          string
	Database          string
	MasterHost        string `yaml:"masterHost"`
	MasterPort        string `yaml:"masterPort"`
	MaxIdleConnection string `yaml:"maxIdleConnection"`
	MaxOpenConnection string `yaml:"maxOpenConnection"`
	UseSSL            string `yaml:"useSSL"`     // "on" or "off"
	ServerName        string `yaml:"serverName"` // For GcpSQL, set SqlInstanceId.
	ServerCaPath      string `yaml:"serverCaPath"`
	ClientCertPath    string `yaml:"clientCertPath"`
	ClientKeyPath     string `yaml:"clientKeyPath"`

	// GCP SQL
	GcpProjectId string `yaml:"gcpProjectId"`
}

type Dispatcher

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

func NewDispatcher

func NewDispatcher(max int) *Dispatcher

func (*Dispatcher) Wait

func (d *Dispatcher) Wait()

func (*Dispatcher) Work

func (d *Dispatcher) Work(ctx context.Context, proc WorkFunc)

type JSONText

type JSONText json.RawMessage

func (JSONText) MarshalJSON

func (j JSONText) MarshalJSON() ([]byte, error)

MarshalJSON returns j as the JSON encoding of j.

func (*JSONText) Scan

func (j *JSONText) Scan(src interface{}) error

Scan stores the src in *j. No validation is done.

func (JSONText) String

func (j JSONText) String() string

Pretty printing for JSONText types

func (*JSONText) Unmarshal

func (j *JSONText) Unmarshal(v interface{}) error

Unmarshal unmarshal's the json in j to v, as in json.Unmarshal.

func (*JSONText) UnmarshalJSON

func (j *JSONText) UnmarshalJSON(data []byte) error

UnmarshalJSON sets *j to a copy of data

func (JSONText) Value

func (j JSONText) Value() (driver.Value, error)

Value returns j as a value. This does a validating unmarshal into another RawMessage. If j is invalid json, it returns an error.

type Logging added in v0.4.0

type Logging struct {
	Level string
}

type Messaging added in v0.4.0

type Messaging struct {
	Provider       string
	ThumbnailTopic string `yaml:"thumbnailTopic"`

	// GCP Pubsub
	GcpProjectId string `yaml:"gcpProjectId"`
	GcpJwtPath   string `yaml:"gcpJwtPath"`
}

type Notification added in v0.4.0

type Notification struct {
	Provider            string
	RoomTopicNamePrefix string `yaml:"roomTopicNamePrefix"`

	// AWS SNS
	AwsRegion                string `yaml:"awsRegion"`
	AwsAccessKeyId           string `yaml:"awsAccessKeyId"`
	AwsSecretAccessKey       string `yaml:"awsSecretAccessKey"`
	AwsApplicationArnIos     string `yaml:"awsApplicationArnIos"`
	AwsApplicationArnAndroid string `yaml:"awsApplicationArnAndroid"`
}

type RealtimeServer

type RealtimeServer struct {
	Endpoint string
}

type Storage added in v0.4.0

type Storage struct {
	Provider           string
	UploadBucket       string `yaml:"uploadBucket"`
	UploadDirectory    string `yaml:"uploadDirectory"`
	ThumbnailBucket    string `yaml:"thumbnailBucket"`
	ThumbnailDirectory string `yaml:"thumbnailDirectory"`

	// Local
	BaseUrl   string `yaml:"baseUrl"`
	LocalPath string `yaml:"localPath"`

	// GCP Storage
	GcpProjectId string `yaml:"gcpProjectId"`
	GcpJwtPath   string `yaml:"gcpJwtPath"`

	// AWS S3
	AwsRegion          string `yaml:"awsRegion"`
	AwsAccessKeyId     string `yaml:"awsAccessKeyId"`
	AwsSecretAccessKey string `yaml:"AwsSecretAccessKey"`
}

type WorkFunc

type WorkFunc func(context.Context)

Jump to

Keyboard shortcuts

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