expr

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2024 License: MIT Imports: 2 Imported by: 0

README

go-expr-exec

go-expr-exec is a Lightweight expression executor for Go operations

Features

Install

go get github.com/l3lcss/go-expr-exec

Usage

package main

import (
 "fmt"
 "log"

 "github.com/l3lcss/go-expr-exec"
)

func main() {
 result, err := expr.Execute(1, expr.RelationalOperatorEqualTo, 1)
 if err != nil {
  log.Fatalf("Error %s", err.Error())
 }

 fmt.Printf("result: %v\n", result)
}

// out
result: true

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute[T cmp.Ordered](operand1 T, operator Operator, operand2 T) (any, error)

Types

type Operator

type Operator string
const (
	RelationalOperatorEqualTo              Operator = "EQUAL_TO"
	RelationalOperatorGreaterThan          Operator = "GREATER_THAN"
	RelationalOperatorGreaterThanOrEqualTo Operator = "GREATER_THAN_OR_EQUAL_TO"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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