stack

package
v0.0.0-...-def07b7 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const BlockingMarshallingStackInstanceTemplate = `// do not modify, generated file
package stack

import (
	"fmt"
	"log"
	"os"
	"strings"

	"{{PkgPathRoot}}/fullstack"
	"{{PkgPathRoot}}/models"
	"{{PkgPathRoot}}/orm"
	"{{PkgPathRoot}}/probe"

	{{pkgname}}_go "{{PkgPathRoot}}"

	"github.com/gin-gonic/gin"
)

// hook marhalling to stage
type BeforeCommitImplementation struct {
	marshallOnCommit string

	packageName string
}

func (impl *BeforeCommitImplementation) BeforeCommit(stage *models.Stage) {
` + stackInstanceTemplateEpilogue
View Source
const DebouncedMarshallingStackInstanceTemplate = `// do not modify, generated file
package stack

import (
	"fmt"
	"log"
	"os"
	"strings"
	"sync"
	"time"

	"{{PkgPathRoot}}/fullstack"
	"{{PkgPathRoot}}/models"
	"{{PkgPathRoot}}/orm"
	"{{PkgPathRoot}}/probe"

	{{pkgname}}_go "{{PkgPathRoot}}"

	"github.com/gin-gonic/gin"
)

// hook marhalling to stage
type BeforeCommitImplementation struct {
	marshallOnCommit string

	packageName string

	mu    sync.Mutex
	timer *time.Timer
}

const debounceDuration = 2 * time.Second

func (impl *BeforeCommitImplementation) BeforeCommit(stage *models.Stage) {
	impl.mu.Lock()
	defer impl.mu.Unlock()

	// If a timer is already running, stop it.
	if impl.timer != nil {
		impl.timer.Stop()
	}

	// Start a new timer. When it fires, it will execute performMarshalling
	// in a new goroutine.
	impl.timer = time.AfterFunc(debounceDuration, func() {
		go impl.performMarshalling(stage)
	})
}

func (impl *BeforeCommitImplementation) performMarshalling(stage *models.Stage) {
` + stackInstanceTemplateEpilogue

Variables

View Source
var ModelGongNewStackInstanceStructSubTemplateCode map[string]string = map[string]string{
	string(rune(ModelGongNewStackInstanceSet)): `
	models.SetOrchestratorOnAfterUpdate[models.{{Structname}}](stage)`,
}

Functions

This section is empty.

Types

type ModelGongNewStackInstanceStructInsertionId

type ModelGongNewStackInstanceStructInsertionId int
const (
	ModelGongNewStackInstanceSet ModelGongNewStackInstanceStructInsertionId = iota
)

Jump to

Keyboard shortcuts

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