Files
napi-go/boolean.go
Matheus Sampaio Queiroga 32f3ff500d Update pkg to same Node addon Header (#8)
Reviewed-on: #8
Co-authored-by: Matheus Sampaio Queiroga <srherobrine20@gmail.com>
Co-committed-by: Matheus Sampaio Queiroga <srherobrine20@gmail.com>
2025-04-27 06:59:21 +00:00

21 lines
539 B
Go

package napi
import "sirherobrine23.com.br/Sirherobrine23/napi-go/internal/napi"
type Boolean struct{ value }
// Convert [ValueType] to [*Boolean]
func ToBoolean(o ValueType) *Boolean { return &Boolean{o} }
func CreateBoolean(env EnvType, value bool) (*Boolean, error) {
v, err := mustValueErr(napi.GetBoolean(env.NapiValue(), value))
if err != nil {
return nil, err
}
return ToBoolean(N_APIValue(env, v)), nil
}
func (bo *Boolean) Value() (bool, error) {
return mustValueErr(napi.GetValueBool(bo.NapiEnv(), bo.NapiValue()))
}