Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var BarcodeFunc = function.New(&function.Spec{ Description: "Generates a barcode image as a bytes object with content_type image/png", Params: []function.Parameter{ {Name: "type", Type: cty.String}, {Name: "data", Type: cty.String}, }, VarParam: &function.Parameter{ Name: "options", Type: cty.DynamicPseudoType, AllowDynamicType: true, AllowNull: true, }, Type: func(args []cty.Value) (cty.Type, error) { if len(args) > 3 { return cty.NilType, fmt.Errorf("barcode() takes 2 or 3 arguments") } return bytescty.BytesObjectType, nil }, Impl: func(args []cty.Value, retType cty.Type) (cty.Value, error) { btype := args[0].AsString() data := args[1].AsString() var optVal cty.Value if len(args) > 2 { optVal = args[2] } opts, err := parseBarcodeOptions(optVal, btype) if err != nil { return cty.NilVal, err } return encodeBarcode(btype, data, opts) }, })
BarcodeFunc generates a barcode image and returns it as a bytes object with content_type "image/png". Called as barcode(type, data) or barcode(type, data, options).
Functions ¶
func GetBarcodeFunctions ¶
GetBarcodeFunctions returns the barcode function set for registration in a cty evaluation context.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.