daas

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2022 License: MIT Imports: 29 Imported by: 0

README

GoAsA

Library golang for Data As a Service Project

Documentation

Index

Constants

View Source
const (
	ENV        = "ENV"
	DEBUG      = "DEBUG"
	SENTRY_ENV = "SENTRY_ENV"
	SENTRY_DSN = "SENTRY_DSN"
)
View Source
const (
	FILE_VERSION = "VERSION"
	APP_NAME     = "APP_NAME"
	APP_BU       = "APP_BU"
)
View Source
const (
	PGHOST     = "DAAS_HOST"
	PGPORT     = "DAAS_PORT"
	PGUSER     = "DAAS_USER"
	PGPASSWORD = "DAAS_PASS"
	PGDATABASE = "DAAS_DBNAME"
	PGLIFETIME = "DAAS_LIFETIME"
	PGMAXIDLE  = "DAAS_MAXIDLE"
	PGMAXCONN  = "DAAS_MAXCONN"
)

Variables

This section is empty.

Functions

func Debug

func Debug(v ...interface{})

func DebugNewline

func DebugNewline()

func Debugf

func Debugf(format string, v ...interface{})

func Debugv

func Debugv(v ...interface{})

func DisableOutput

func DisableOutput()

func Error

func Error(v ...interface{})

func ErrorHandler

func ErrorHandler(c *fiber.Ctx, code int, err error) error

func ErrorHandlerThrow

func ErrorHandlerThrow(c *fiber.Ctx, code int, err error) error

func ErrorThrow

func ErrorThrow(errMsg string)

func ErrorThrowf

func ErrorThrowf(format string, v ...interface{})

func Errorf

func Errorf(format string, v ...interface{})

func Estimated

func Estimated(start time.Time) int

func EstimatedPrint

func EstimatedPrint(start time.Time, name string, ctx ...*fiber.Ctx)

func Fatal

func Fatal(v ...interface{})

func Fatalf

func Fatalf(format string, v ...interface{})

func Info

func Info(v ...interface{})

func Infof

func Infof(format string, v ...interface{})

func Initialize

func Initialize(appName string) (appTitle string, appVersion string, appIsProduction bool)

func IsRollback

func IsRollback(err error, stx *PGTx) bool

func IsRollbackThrow

func IsRollbackThrow(err error, stx *PGTx) bool

func Round

func Round(n float64, m float64) float64

Round math Round decimal

func ToSize

func ToSize(size int) string

func Warn

func Warn(v ...interface{})

func Warnf

func Warnf(format string, v ...interface{})

Types

type CSV

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

func (*CSV) AddHeader

func (file *CSV) AddHeader(data ...string) error

func (*CSV) Appendln

func (file *CSV) Appendln(data ...string) error

func (*CSV) GetColumns

func (file *CSV) GetColumns() string

func (*CSV) GetDelimiter

func (file *CSV) GetDelimiter() string

func (*CSV) GetFilePath

func (file *CSV) GetFilePath() string

func (*CSV) Remove

func (file *CSV) Remove() error

func (*CSV) Save

func (file *CSV) Save() error

type Courier

type Courier struct {
	ID     string
	Paging struct {
		Limit  int `json:"limit"`
		Record int `json:"record"`
	}
}

type DataStore

type DataStore struct {
	AppID      string
	CourierMap map[string]*Courier
	BuAPIMap   map[string]bool
	TokenSet   SubSet
}

func PrepareDataStore

func PrepareDataStore(pgx *PGClient, ctx *context.Context, appTitle string, appName string) *DataStore

func (*DataStore) BUCodeVerifyAPI

func (d *DataStore) BUCodeVerifyAPI(buCode string) error

func (*DataStore) GetCourierConfig

func (d *DataStore) GetCourierConfig(courierId string) *Courier

func (*DataStore) GetCourierId

func (d *DataStore) GetCourierId(auth string) string

func (*DataStore) SetConfigBUAllow

func (d *DataStore) SetConfigBUAllow(stx *PGTx) error

func (*DataStore) SetConfigCourierToken

func (d *DataStore) SetConfigCourierToken(stx *PGTx) error

type HTTP

type HTTP struct {
	Code  int     `json:"code,omitempty"`
	Error *string `json:"error"`
}

func HttpErrorPrint

func HttpErrorPrint(code int, format string, v ...interface{}) *HTTP

func HttpErrorPrintf

func HttpErrorPrintf(code int, v ...interface{}) *HTTP

func HttpErrorf

func HttpErrorf(code int, err error) *HTTP

func (*HTTP) ErrorHandlerThrow

func (e *HTTP) ErrorHandlerThrow(c *fiber.Ctx) error

type HTTPRequest

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

func CreateClient

func CreateClient(config *HTTPTransport) (*HTTPRequest, error)

func (*HTTPRequest) HeaderAdd

func (e *HTTPRequest) HeaderAdd(name string, value string)

func (*HTTPRequest) HeaderClear

func (e *HTTPRequest) HeaderClear()

func (*HTTPRequest) Send

func (e *HTTPRequest) Send(reqMethod string, reqUrl string, reqBuffer []byte) ([]byte, int, time.Duration, error)

type HTTPTransport

type HTTPTransport struct {
	AppName            string
	AppVersion         string
	DisableCompression bool
	DisableKeepAlive   bool
	SkipVerify         bool
	Timeout            int
	AllowRedirects     bool
	ClientCert         string
	ClientKey          string
	CACert             string
	UseHTTP2           bool
}

type PGClient

type PGClient struct {
	DB *sql.DB
	// contains filtered or unexported fields
}

func (*PGClient) Begin

func (pg *PGClient) Begin() (*PGTx, error)

func (*PGClient) Close

func (pg *PGClient) Close() error

func (*PGClient) Connect

func (pg *PGClient) Connect(c *context.Context, appTitle string)

func (*PGClient) CreateChannel

func (pg *PGClient) CreateChannel(appTitle string) (*PGNotify, error)

type PGNotify

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

func (*PGNotify) Close

func (pg *PGNotify) Close() error

func (*PGNotify) Listen

func (pg *PGNotify) Listen(channelName string, eventCallback func(e *pq.Notification)) error

func (*PGNotify) Ping

func (pg *PGNotify) Ping() error

type PGRecord

type PGRecord []PGRow

func (PGRecord) Find

func (row PGRecord) Find(columnName string, compareValue string) bool

type PGRow

type PGRow map[string]string

func (PGRow) ToBoolean

func (pg PGRow) ToBoolean(name string) bool

func (PGRow) ToByte

func (pg PGRow) ToByte(name string) []byte

func (PGRow) ToFloat64

func (pg PGRow) ToFloat64(name string) float64

func (PGRow) ToInt64

func (pg PGRow) ToInt64(name string) int64

func (PGRow) ToTime

func (pg PGRow) ToTime(name string) time.Time

type PGTx

type PGTx struct {
	Closed bool
	// contains filtered or unexported fields
}

func (*PGTx) Commit

func (stx *PGTx) Commit() error

func (*PGTx) Execute

func (stx *PGTx) Execute(query string, args ...interface{}) error

func (*PGTx) ExecutePrint

func (stx *PGTx) ExecutePrint(query string, args ...interface{}) error

func (*PGTx) FetchAll

func (stx *PGTx) FetchAll(rows *sql.Rows) (PGRecord, error)

func (*PGTx) FetchOneColumn

func (stx *PGTx) FetchOneColumn(rows *sql.Rows, columnName string) (SubSet, error)

func (*PGTx) FetchRow

func (stx *PGTx) FetchRow(rows *sql.Rows) (PGRow, error)

func (*PGTx) Query

func (stx *PGTx) Query(query string, args ...interface{}) (*sql.Rows, error)

func (*PGTx) QueryOne

func (stx *PGTx) QueryOne(query string, args ...interface{}) (PGRow, error)

func (*PGTx) QueryOnePrint

func (stx *PGTx) QueryOnePrint(query string, args ...interface{}) (PGRow, error)

func (*PGTx) QueryPrint

func (stx *PGTx) QueryPrint(query string, args ...interface{}) (*sql.Rows, error)

func (*PGTx) Rollback

func (stx *PGTx) Rollback() error

type SubSet

type SubSet []string

func (*SubSet) Find

func (s *SubSet) Find(val string) int

func (*SubSet) ToParam

func (s *SubSet) ToParam() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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