t

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const TIMEZONE_LAYOUT = "2006-01-02 15:04:05-07"

Variables

This section is empty.

Functions

func MarshalFileData added in v0.1.3

func MarshalFileData(src []byte) graphql.Marshaler

func UnmarshalFileData added in v0.1.3

func UnmarshalFileData(v interface{}) ([]byte, error)

Types

type Amount

type Amount struct {
	decimal.Decimal
}

* 在資料庫使用此欄位時,要使用NUMRIC避免精度消失 * 只要金錢相關的欄位都應該用此type,避免計算過程有精度消失的問題

func NewAmountFromDecimal

func NewAmountFromDecimal(d decimal.Decimal) (Amount, error)

func NewAmountFromString

func NewAmountFromString(str string) (Amount, error)

func (Amount) Add

func (a Amount) Add(arr ...Amount) (Amount, error)

func (Amount) EncodeValues

func (a Amount) EncodeValues(key string, v *url.Values) error

func (*Amount) Equal

func (a *Amount) Equal(y Amount) bool

func (Amount) MarshalGQL

func (a Amount) MarshalGQL(w io.Writer)

func (*Amount) MarshalJSON

func (a *Amount) MarshalJSON() ([]byte, error)

func (Amount) Mul

func (a Amount) Mul(y Amount) (Amount, error)

如果在算式裡執行了這個,肯定是哪裡寫錯了!!

func (Amount) MultiplyRatio

func (a Amount) MultiplyRatio(r Ratio) (Amount, error)

func (*Amount) Scan

func (a *Amount) Scan(value interface{}) error

func (Amount) Sub

func (a Amount) Sub(arr ...Amount) (Amount, error)

func (*Amount) UnmarshalGQL

func (a *Amount) UnmarshalGQL(v interface{}) error

func (*Amount) UnmarshalJSON

func (a *Amount) UnmarshalJSON(b []byte) error

func (Amount) Value

func (a Amount) Value() (driver.Value, error)

type BigID

type BigID uint64

func (BigID) MarshalGQL

func (id BigID) MarshalGQL(w io.Writer)

func (*BigID) UnmarshalGQL

func (id *BigID) UnmarshalGQL(v interface{}) error

type BigIDArray

type BigIDArray []BigID

func (*BigIDArray) Includes added in v0.1.3

func (ids *BigIDArray) Includes(target BigID) bool

func (BigIDArray) MarshalGQL

func (arr BigIDArray) MarshalGQL(w io.Writer)

func (*BigIDArray) Scan

func (ids *BigIDArray) Scan(value interface{}) error

func (*BigIDArray) UnmarshalGQL

func (id *BigIDArray) UnmarshalGQL(v interface{}) error

func (BigIDArray) Value

func (ids BigIDArray) Value() (driver.Value, error)

type FileData added in v0.1.3

type FileData = []byte

type Flow added in v0.1.6

type Flow struct {
	decimal.Decimal
}

* 在資料庫使用此欄位時,要使用NUMRIC避免精度消失 * 只要金錢相關的欄位都應該用此type,避免計算過程有精度消失的問題 * Flow可以是負數

func NewFlowFromDecimal added in v0.1.6

func NewFlowFromDecimal(d decimal.Decimal) (Flow, error)

func NewFlowFromString added in v0.1.6

func NewFlowFromString(str string) (Flow, error)

func (Flow) Add added in v0.1.6

func (a Flow) Add(arr ...Flow) (Flow, error)

func (Flow) EncodeValues added in v0.1.6

func (a Flow) EncodeValues(key string, v *url.Values) error

func (*Flow) Equal added in v0.1.6

func (a *Flow) Equal(y Flow) bool

func (Flow) MarshalGQL added in v0.1.6

func (a Flow) MarshalGQL(w io.Writer)

func (*Flow) MarshalJSON added in v0.1.6

func (a *Flow) MarshalJSON() ([]byte, error)

func (Flow) Mul added in v0.1.6

func (a Flow) Mul(y Flow) (Flow, error)

如果在算式裡執行了這個,肯定是哪裡寫錯了!!

func (*Flow) Scan added in v0.1.6

func (a *Flow) Scan(value interface{}) error

func (Flow) Sub added in v0.1.6

func (a Flow) Sub(arr ...Flow) (Flow, error)

func (*Flow) UnmarshalGQL added in v0.1.6

func (a *Flow) UnmarshalGQL(v interface{}) error

func (*Flow) UnmarshalJSON added in v0.1.6

func (a *Flow) UnmarshalJSON(b []byte) error

func (Flow) Value added in v0.1.6

func (a Flow) Value() (driver.Value, error)

type ID

type ID uint32

func (ID) MarshalGQL

func (id ID) MarshalGQL(w io.Writer)

func (*ID) UnmarshalGQL

func (id *ID) UnmarshalGQL(v interface{}) error

type IDArray

type IDArray []ID

func (*IDArray) Includes added in v0.1.3

func (ids *IDArray) Includes(target ID) bool

func (IDArray) MarshalGQL

func (arr IDArray) MarshalGQL(w io.Writer)

func (*IDArray) Scan

func (ids *IDArray) Scan(value interface{}) error

func (*IDArray) UnmarshalGQL

func (id *IDArray) UnmarshalGQL(v interface{}) error

func (IDArray) Value

func (ids IDArray) Value() (driver.Value, error)

type IP added in v0.1.3

type IP string

func ParseIP added in v0.1.3

func ParseIP(ipString string) IP

func UniqueIPs added in v0.1.4

func UniqueIPs(ips []IP) []IP

func (IP) MarshalGQL added in v0.1.3

func (ip IP) MarshalGQL(w io.Writer)

func (*IP) Scan added in v0.1.3

func (i *IP) Scan(value interface{}) error

func (*IP) UnmarshalGQL added in v0.1.3

func (ip *IP) UnmarshalGQL(v interface{}) error

func (IP) Value added in v0.1.3

func (i IP) Value() (driver.Value, error)

type IPArray added in v0.1.3

type IPArray []IP

func (*IPArray) Includes added in v0.1.3

func (ips *IPArray) Includes(ip IP) bool

func (*IPArray) Scan added in v0.1.3

func (ips *IPArray) Scan(value interface{}) error

func (*IPArray) UnmarshalGQL added in v0.1.3

func (ips *IPArray) UnmarshalGQL(v interface{}) error

func (IPArray) Value added in v0.1.3

func (ips IPArray) Value() (driver.Value, error)

type JSONList added in v0.1.3

type JSONList []interface{}

func (JSONList) MarshalGQL added in v0.1.3

func (m JSONList) MarshalGQL(w io.Writer)

func (*JSONList) Scan added in v0.1.3

func (m *JSONList) Scan(value interface{}) error

func (*JSONList) UnmarshalGQL added in v0.1.3

func (m *JSONList) UnmarshalGQL(v interface{}) error

func (JSONList) Value added in v0.1.3

func (m JSONList) Value() (driver.Value, error)

type JSONMap added in v0.1.3

type JSONMap map[string]interface{}

func (JSONMap) MarshalGQL added in v0.1.3

func (m JSONMap) MarshalGQL(w io.Writer)

func (*JSONMap) Scan added in v0.1.3

func (m *JSONMap) Scan(value interface{}) error

func (*JSONMap) UnmarshalGQL added in v0.1.3

func (m *JSONMap) UnmarshalGQL(v interface{}) error

func (JSONMap) Value added in v0.1.3

func (m JSONMap) Value() (driver.Value, error)

type Ratio

type Ratio uint64

* 1點為0.00000001 * 在資料庫使用此欄位時,須使用BIGINT * 在資料庫不使用NUMEIC是因為這樣容量需求比較小(8 bytes) * MaxUint64: 9223372036854775807

func MultiplyRatios added in v0.1.2

func MultiplyRatios(arr ...Ratio) (Ratio, error)

func NewRatioFromDecimal

func NewRatioFromDecimal(d decimal.Decimal) (Ratio, error)

最小單位0.00000001,小於0.00000001的值將會被忽略 最終都要由NewRatioFromDecimal來生成Ratio, 才會檢查該值的合理性

func NewRatioFromString

func NewRatioFromString(str string) (Ratio, error)

str: 輸入最小單位0.00000001,小於0.00000001的值將會被忽略

func (Ratio) Add

func (r Ratio) Add(arr ...Ratio) (Ratio, error)

func (Ratio) Decimal

func (r Ratio) Decimal() decimal.Decimal

func (Ratio) EncodeValues

func (r Ratio) EncodeValues(key string, v *url.Values) error

func (Ratio) MarshalGQL

func (r Ratio) MarshalGQL(w io.Writer)

func (*Ratio) MarshalJSON

func (r *Ratio) MarshalJSON() ([]byte, error)

func (Ratio) Mul

func (r Ratio) Mul(arr ...Ratio) (Ratio, error)

func (Ratio) MultiplyAmount

func (r Ratio) MultiplyAmount(amount Amount) (Amount, error)

func (Ratio) Sub

func (r Ratio) Sub(arr ...Ratio) (Ratio, error)

func (*Ratio) UnmarshalGQL

func (r *Ratio) UnmarshalGQL(v interface{}) error

func (*Ratio) UnmarshalJSON

func (r *Ratio) UnmarshalJSON(b []byte) error

type SmallID

type SmallID uint16

func (SmallID) MarshalGQL

func (id SmallID) MarshalGQL(w io.Writer)

func (*SmallID) UnmarshalGQL

func (id *SmallID) UnmarshalGQL(v interface{}) error

type SmallIDArray

type SmallIDArray []SmallID

func (*SmallIDArray) Includes added in v0.1.3

func (ids *SmallIDArray) Includes(target SmallID) bool

func (SmallIDArray) MarshalGQL

func (arr SmallIDArray) MarshalGQL(w io.Writer)

func (*SmallIDArray) Scan

func (ids *SmallIDArray) Scan(value interface{}) error

func (*SmallIDArray) UnmarshalGQL

func (id *SmallIDArray) UnmarshalGQL(v interface{}) error

func (SmallIDArray) Value

func (ids SmallIDArray) Value() (driver.Value, error)

type TextArray added in v0.1.4

type TextArray []string

func (*TextArray) Scan added in v0.1.4

func (t *TextArray) Scan(value interface{}) error

func (TextArray) Value added in v0.1.4

func (t TextArray) Value() (driver.Value, error)

type TimeArray added in v0.1.3

type TimeArray []*time.Time

func (*TimeArray) Scan added in v0.1.3

func (ts *TimeArray) Scan(value interface{}) error

func (TimeArray) Value added in v0.1.3

func (ts TimeArray) Value() (driver.Value, error)

type TinyID

type TinyID uint8

func (TinyID) MarshalGQL

func (id TinyID) MarshalGQL(w io.Writer)

func (*TinyID) UnmarshalGQL

func (id *TinyID) UnmarshalGQL(v interface{}) error

type TinyIDArray

type TinyIDArray []TinyID

func (*TinyIDArray) Includes added in v0.1.3

func (ids *TinyIDArray) Includes(target TinyID) bool

func (TinyIDArray) MarshalGQL

func (arr TinyIDArray) MarshalGQL(w io.Writer)

func (*TinyIDArray) Scan

func (ids *TinyIDArray) Scan(value interface{}) error

func (*TinyIDArray) UnmarshalGQL

func (id *TinyIDArray) UnmarshalGQL(v interface{}) error

func (TinyIDArray) Value

func (ids TinyIDArray) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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