gobpmn

package module
v0.2.0-dev Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2025 License: MIT Imports: 10 Imported by: 0

README

gobpmn

gobpmn

Description

gobpmn is an experimental library that makes it possible to reflect

  • structs,
  • anonymous fields,
  • typed and
  • generic maps

in Go and create business process models with it.

As a modeler with a CLI, gobpmn is a monorepo with clear encapsulation.

STILL IN DEVELOPMENT

Requirements

  • Go >= 1.24

Optional:

  • Saxon >= 12.5 (Requires Java >= 23)

Install

  1. Clone the repository or the download the .zip-File of the repository
  2. Install the latest gobpmn version as a package within a module with go get
  3. Install the latest gobpmn version as a package outside of a module with go install
go get github.com/deemount/gobpmn@latest
go install github.com/deemount/gobpmn@latest

Examples

go run examples/generic_map_simple_process/main.go
go run examples/typed_map_simple_process/main.go
go run examples/renting_process/main.go
go run examples/simple_process/main.go
go run examples/small_process/main.go

How To

package main

import (
    "log"
    "github.com/deemount/gobpmn"
)

type Process struct {
    Def             gobpmn.Repository
    IsExecutable    bool
    Process         gobpmn.BPMN
    StartEvent      gobpmn.BPMN
    FromStartEvent  gobpmn.BPMN
    Task            gobpmn.BPMN
    FromTask        gobpmn.BPMN
    EndEvent        gobpmn.BPMN
}

func (p Process) GetDefinitions() gobpmn.Repository {
    return p.Def
}

func main() {
    _, err := gobpmn.FromStruct(Process{})
    if err != nil {
        log.Fatalf("ERROR: %s", err)
        return
    }
}
package main

import (
    "log"
    "github.com/deemount/gobpmn"
)

var Process = map[string]any{
    "Def":                 gobpmn.Definitions(),
    "IsExecutable":        true,
    "Process":             gobpmn.BPMN{Pos: 1},
    "StartEvent":          gobpmn.BPMN{Pos: 2},
    "FromStartEvent":      gobpmn.BPMN{Pos: 3},
    "Task":                gobpmn.BPMN{Pos: 4},
    "FromTask":            gobpmn.BPMN{Pos: 5},
    "EndEvent":            gobpmn.BPMN{Pos: 6},
}

func main() {
    type T any
    _, err := gobpmn.FromMap[T](Process)
    if err != nil {
        log.Fatalf("ERROR: %s", err)
        return
    }
}

Wiki

Read the documentation

Checkout the other projects for BPMN written in Go

Check my articles for this project on medium.com

Documentation

Overview

gobpmn.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromMap

func FromMap[T any](model T, opts ...Options) (parser.BPMNParserRepository, error)

FromMap creates a BPMN model from a generic or typed map definition

func FromStruct

func FromStruct[T HasDefinitions](model T, opts ...Options) (parser.BPMNParserRepository, error)

FromStruct creates a BPMN model from a static struct definition

Types

type BPMN

type BPMN = types.BPMN

BPMN is a re-exported type from the types package

type HasDefinitions

type HasDefinitions interface {
	GetDefinitions() Repository
}

HasDefinitions is an interface for types that have a GetDefinitions method that returns a DefinitionsRepository. This is used to create a BPMN model from a static struct definition.

type Options

type Options struct {
	Timeout  time.Duration
	Validate bool
}

Options defines global optional parameters for model creation

func DefaultOptions

func DefaultOptions() Options

DefaultOptions provides sane defaults (e.g., 60s timeout)

type Repository

type Repository = foundation.DefinitionsRepository

DefRepo is a re-exported type from the foundation package

func Definitions

func Definitions() Repository

NewDefinitions creates a new DefinitionsRepository with a new Definitions struct. This is a convenience function to create a new DefinitionsRepository without having to create a new Definitions struct manually.

Directories

Path Synopsis
examples
renting_process command
simple_process command
small_process command
internal
pkg

Jump to

Keyboard shortcuts

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