rpg

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DataTypeMap map[string]string = map[string]string{

	"INTEGER 3i0":  "3i0",
	"INTEGER 5i0":  "5i0",
	"INTEGER 10i0": "10i0",
	"INTEGER 20i0": "20i0",

	"UNSIGNED INTEGER 3u0":  "3u0",
	"UNSIGNED INTEGER 5u0":  "5u0",
	"UNSIGNED INTEGER 10u0": "10u0",
	"UNSIGNED INTEGER 20u0": "20u0",

	"PACKED":   "%dp%d",
	"ZONED":    "%ds%d",
	"FLOAT 4f": "4f2",
	"FLOAT 8f": "8f2",

	"VARYING ALPHANUMERIC/CHAR": "%da",
	"ALPHANUMERIC/CHAR":         "%da",
	"TIME":                      "8A",
	"TIMESTAMP":                 "26A",
	"DATE":                      "10A",
}

------------------------------------------------------------

------------------------------------------------------------

View Source
var DataTypeSpecialText map[string]string = map[string]string{

	"VARYING ALPHANUMERIC/CHAR": "varying='on'",
}

------------------------------------------------------------

------------------------------------------------------------

View Source
var DataTypeValidator map[string]func(string, int, int) bool = map[string]func(string, int, int) bool{

	"INTEGER 3i0":  intValidator,
	"INTEGER 5i0":  intValidator,
	"INTEGER 10i0": intValidator,
	"INTEGER 20i0": intValidator,

	"UNSIGNED INTEGER 3u0":  uintValidator,
	"UNSIGNED INTEGER 5u0":  uintValidator,
	"UNSIGNED INTEGER 10u0": uintValidator,
	"UNSIGNED INTEGER 20u0": uintValidator,

	"PACKED":   floatValidator,
	"ZONED":    floatValidator,
	"FLOAT 4f": floatValidator,
	"FLOAT 8f": floatValidator,

	"VARYING ALPHANUMERIC/CHAR": charValidator,
	"ALPHANUMERIC/CHAR":         charValidator,
	"TIME":                      timeValidator,
	"TIMESTAMP":                 dateValidator,
	"DATE":                      timestampValidator,
}

------------------------------------------------------------

------------------------------------------------------------

Functions

func DataTypeNeedDecimalValue

func DataTypeNeedDecimalValue(dataType string) bool

------------------------------------------------------------

------------------------------------------------------------

func DataTypeNeedLength

func DataTypeNeedLength(dataType string) bool

------------------------------------------------------------

------------------------------------------------------------

Types

type DSField

type DSField struct {
	NameToUse           string
	ParamID             string
	Dim                 uint
	Param               *Param            `json:"-" db:"-" form:"-"`
	validator.Validator `db:"-" form:"-"` // this contains the fielderror

}

-----------------------------------------------------

-----------------------------------------------------

type Param

type Param struct {
	ID string `json:"id" db:"id" form:"id"`

	Name            string `json:"name" db:"name" form:"name"`
	DataType        string `json:"datatype" db:"datatype" form:"datatype"`
	Length          uint   `json:"length" db:"length" form:"length"`
	DecimalPostions uint   `json:"decimalpostions" db:"decimalpostions" form:"decimalpostions"`

	IsDs     bool `json:"isds" db:"isds" form:"isds"`
	DsFields []*DSField

	validator.Validator `json:"-" db:"-" form:"-"` // this contains the fielderror

}

func (*Param) AssignDSFieldNames

func (p *Param) AssignDSFieldNames()

------------------------------------------------------------

------------------------------------------------------------

func (*Param) DsHasField

func (p *Param) DsHasField(fieldId string) bool

------------------------------------------------------------

------------------------------------------------------------

func (*Param) DsJson

func (p *Param) DsJson(dim uint) []map[string]any

------------------------------------------------------------

------------------------------------------------------------

func (*Param) FilterOutInvalidParams

func (p *Param) FilterOutInvalidParams()

------------------------------------------------------------

------------------------------------------------------------

func (*Param) GetDataType

func (p *Param) GetDataType() string

-----------------------------------------------------

-----------------------------------------------------

func (*Param) GetSpecialText

func (p *Param) GetSpecialText() string

-----------------------------------------------------

-----------------------------------------------------

func (*Param) HasValidValue

func (p *Param) HasValidValue(val string) bool

-----------------------------------------------------

-----------------------------------------------------

func (*Param) Init

func (p *Param) Init()

------------------------------------------------------------

------------------------------------------------------------

func (*Param) IsValid

func (p *Param) IsValid() error

-----------------------------------------------------

-----------------------------------------------------

func (*Param) LogImage

func (s *Param) LogImage() string

------------------------------------------------------------

------------------------------------------------------------

func (*Param) NoNDsJson

func (p *Param) NoNDsJson(dim uint) []string

------------------------------------------------------------

------------------------------------------------------------

func (*Param) ToString

func (p *Param) ToString() string

------------------------------------------------------------

------------------------------------------------------------

func (*Param) ToXml

func (p *Param) ToXml(nameToUse string, inparams map[string]xmlutils.ValueDatatype, usage string, dim uint) (string, error)

-----------------------------------------------------

-----------------------------------------------------

func (*Param) ValidateFields

func (p *Param) ValidateFields() bool

------------------------------------------------------------

------------------------------------------------------------

type ProgramParams

type ProgramParams struct {
	Seq                 uint
	Dim                 uint
	InOutType           string
	FieldID             string
	Placement           string
	NameToUse           string
	Param               *Param                     `json:"-" db:"-" form:"-"`
	validator.Validator `json:"-" db:"-" form:"-"` // this contains the fielderror

}

-----------------------------------------------------

-----------------------------------------------------

func (*ProgramParams) GetNameToUse

func (p *ProgramParams) GetNameToUse() string

-----------------------------------------------------

-----------------------------------------------------

type RpgEndPoint

type RpgEndPoint struct {
	ID                 string   `json:"id" db:"id" form:"id"`
	EndPointName       string   `json:"endpointname" db:"endpointname" form:"endpointname"`
	HttpMethod         string   `json:"httpmethod" db:"httpmethod" form:"httpmethod"`
	DefaultServerId    string   `json:"serverid" db:"serverid" form:"serverid"`
	AllowedOnServers   []string `json:"allowedonservers" db:"allowedonservers" form:"allowedonservers"`
	MockUrl            string   `json:"mockurl" db:"mockurl" form:"-"`
	MockUrlWithoutAuth string   `json:"mockurlnoa" db:"mockurlnoa" form:"-"`
	AllowWithoutAuth   bool     `json:"awoauth" db:"awoauth" form:"awoauth"`
	HtmlTemplate       string   `json:"htmltemplate" db:"htmltemplate" form:"htmltemplate"`
	Namespace          string   `json:"namespace" db:"namespace" form:"namespace"`
	InputPayload       string   `json:"inputpayload" db:"inputpayload" form:"inputpayload"`
	ResponseFormat     string   `json:"responseformat" db:"responseformat" form:"-"`
	Promotionsql       string   `json:"promotionsql" db:"promotionsql" form:"-"`

	MaxlogEntries int `json:"maxlogentries" db:"maxlogentries" form:"maxlogentries"`

	Name       string `json:"name" db:"name" form:"name"`
	Lib        string `json:"lib" db:"lib" form:"lib"`
	Parameters []*ProgramParams

	validator.Validator `json:"-" db:"-" form:"-"` // this contains the fielderror
}

func (*RpgEndPoint) AddAllowedServer

func (s *RpgEndPoint) AddAllowedServer(serverID string)

------------------------------------------------------------

------------------------------------------------------------

func (*RpgEndPoint) AssignAliasForPathPlacement

func (s *RpgEndPoint) AssignAliasForPathPlacement()

------------------------------------------------------------

------------------------------------------------------------

func (*RpgEndPoint) AssignParamNames

func (p *RpgEndPoint) AssignParamNames()

------------------------------------------------------------

------------------------------------------------------------

func (*RpgEndPoint) AssignParamObjects

func (p *RpgEndPoint) AssignParamObjects(rpgParamModel *RpgParamModel)

------------------------------------------------------------

------------------------------------------------------------

func (*RpgEndPoint) AvailableParamterPostions

func (s *RpgEndPoint) AvailableParamterPostions() []string

------------------------------------------------------------

------------------------------------------------------------

func (*RpgEndPoint) BuildMockUrl

func (s *RpgEndPoint) BuildMockUrl()

------------------------------------------------------------ BuildMockUrl(s) ------------------------------------------------------------

func (*RpgEndPoint) BuildMockUrlGET

func (s *RpgEndPoint) BuildMockUrlGET()

------------------------------------------------------------ BuildMockUrl(s) ------------------------------------------------------------

func (*RpgEndPoint) BuildMockUrlPost

func (s *RpgEndPoint) BuildMockUrlPost()

------------------------------------------------------------ BuildMockUrl(s) ------------------------------------------------------------

func (*RpgEndPoint) DeleteAllowedServer

func (s *RpgEndPoint) DeleteAllowedServer(serverID string)

------------------------------------------------------------

------------------------------------------------------------

func (*RpgEndPoint) EPDetailUrl

func (s *RpgEndPoint) EPDetailUrl() template.HTML

------------------------------------------------------------

------------------------------------------------------------

func (*RpgEndPoint) EPHander

func (s *RpgEndPoint) EPHander() string

------------------------------------------------------------

------------------------------------------------------------

func (*RpgEndPoint) EPID

func (s *RpgEndPoint) EPID() string

------------------------------------------------------------

------------------------------------------------------------

func (*RpgEndPoint) EPMaxLogEntries

func (s *RpgEndPoint) EPMaxLogEntries() int

------------------------------------------------------------

------------------------------------------------------------

func (*RpgEndPoint) EPMethod

func (s *RpgEndPoint) EPMethod() string

------------------------------------------------------------

------------------------------------------------------------

func (*RpgEndPoint) EPName

func (s *RpgEndPoint) EPName() string

------------------------------------------------------------

------------------------------------------------------------

func (*RpgEndPoint) EPNameSpace

func (s *RpgEndPoint) EPNameSpace() string

------------------------------------------------------------

------------------------------------------------------------

func (*RpgEndPoint) EPServerId

func (s *RpgEndPoint) EPServerId() string

------------------------------------------------------------

------------------------------------------------------------

func (*RpgEndPoint) EPType

func (s *RpgEndPoint) EPType() string

------------------------------------------------------------

------------------------------------------------------------

func (*RpgEndPoint) FilterOutInvalidParams

func (p *RpgEndPoint) FilterOutInvalidParams()

------------------------------------------------------------

------------------------------------------------------------

func (*RpgEndPoint) GetNamespace

func (s *RpgEndPoint) GetNamespace() string

------------------------------------------------------------

------------------------------------------------------------

func (*RpgEndPoint) Init

func (p *RpgEndPoint) Init()

-----------------------------------------------------

-----------------------------------------------------

func (*RpgEndPoint) InputParamJson

func (s *RpgEndPoint) InputParamJson() string

------------------------------------------------------------ BuildMockUrl(s) ------------------------------------------------------------

func (*RpgEndPoint) IsAllowedForServer

func (s *RpgEndPoint) IsAllowedForServer(serverID string) bool

------------------------------------------------------------

------------------------------------------------------------

func (*RpgEndPoint) IsUsingField

func (p *RpgEndPoint) IsUsingField(rpgParamModel *RpgParamModel, fieldID string) bool

------------------------------------------------------------

------------------------------------------------------------

func (*RpgEndPoint) OutputStructureJson

func (s *RpgEndPoint) OutputStructureJson() string

------------------------------------------------------------ BuildMockUrl(s) ------------------------------------------------------------

func (*RpgEndPoint) ParamStrings

func (p *RpgEndPoint) ParamStrings(inparams map[string]xmlutils.ValueDatatype) ([]string, error)

-----------------------------------------------------

-----------------------------------------------------

func (*RpgEndPoint) Refresh

func (s *RpgEndPoint) Refresh()

-----------------------------------------------------

-----------------------------------------------------

func (*RpgEndPoint) SetNameSpace

func (s *RpgEndPoint) SetNameSpace()

------------------------------------------------------------ set name space value ------------------------------------------------------------

func (*RpgEndPoint) Slug

func (s *RpgEndPoint) Slug() string

------------------------------------------------------------

------------------------------------------------------------

func (*RpgEndPoint) ToXML

func (p *RpgEndPoint) ToXML(inparams map[string]xmlutils.ValueDatatype) (string, error)

-----------------------------------------------------

-----------------------------------------------------

func (*RpgEndPoint) ValidateParams

func (p *RpgEndPoint) ValidateParams() bool

------------------------------------------------------------

------------------------------------------------------------

type RpgEndpointModel

type RpgEndpointModel struct {
	DB *bolt.DB
}

func (*RpgEndpointModel) Delete

func (m *RpgEndpointModel) Delete(id string) error

-----------------------------------------------------------------

----------------------------------------------------------------- We'll use the Insert method to add a new record to the "users" table.

func (*RpgEndpointModel) DeleteByName

func (m *RpgEndpointModel) DeleteByName(name string, method string) error

-----------------------------------------------------------------

----------------------------------------------------------------- We'll use the Insert method to add a new record to the "users" table.

func (*RpgEndpointModel) Duplicate

func (m *RpgEndpointModel) Duplicate(u *RpgEndPoint) bool

-----------------------------------------------------------------

----------------------------------------------------------------- We'll use the Exists method to check if a user exists with a specific ID.

func (*RpgEndpointModel) DuplicateByName

func (m *RpgEndpointModel) DuplicateByName(name string, method string, namespace string) bool

-----------------------------------------------------------------

----------------------------------------------------------------- We'll use the Exists method to check if a user exists with a specific ID.

func (*RpgEndpointModel) Exists

func (m *RpgEndpointModel) Exists(id string) bool

-----------------------------------------------------------------

----------------------------------------------------------------- We'll use the Exists method to check if a user exists with a specific ID.

func (*RpgEndpointModel) Get

func (m *RpgEndpointModel) Get(id string) (*RpgEndPoint, error)

-----------------------------------------------------------------

----------------------------------------------------------------- We'll use the Exists method to check if a user exists with a specific ID.

func (*RpgEndpointModel) List

func (m *RpgEndpointModel) List() []*RpgEndPoint

-----------------------------------------------------------------

----------------------------------------------------------------- We'll use the Exists method to check if a user exists with a specific ID.

func (*RpgEndpointModel) LoadParameter

func (m *RpgEndpointModel) LoadParameter(p *RpgEndPoint)

-----------------------------------------------------------------

----------------------------------------------------------------- We'll use the Exists method to check if a user exists with a specific ID.

func (*RpgEndpointModel) Save

func (m *RpgEndpointModel) Save(u *RpgEndPoint) (string, error)

-----------------------------------------------------------------

----------------------------------------------------------------- We'll use the Insert method to add a new record to the "users" table.

type RpgParamModel

type RpgParamModel struct {
	DB *bolt.DB
}

-----------------------------------------------------------------

----------------------------------------------------------------- Define a new UserModel type which wraps a database connection pool.

func (*RpgParamModel) Delete

func (m *RpgParamModel) Delete(id string) error

-----------------------------------------------------------------

----------------------------------------------------------------- We'll use the Insert method to add a new record to the "users" table.

func (*RpgParamModel) DuplicateName

func (m *RpgParamModel) DuplicateName(rpgparamToCheck *Param) bool

-----------------------------------------------------------------

----------------------------------------------------------------- We'll use the Exists method to check if a user exists with a specific ID.

func (*RpgParamModel) Exists

func (m *RpgParamModel) Exists(id string) bool

-----------------------------------------------------------------

----------------------------------------------------------------- We'll use the Exists method to check if a user exists with a specific ID.

func (*RpgParamModel) Get

func (m *RpgParamModel) Get(id string) (*Param, error)

-----------------------------------------------------------------

----------------------------------------------------------------- We'll use the Exists method to check if a user exists with a specific ID.

func (*RpgParamModel) List

func (m *RpgParamModel) List() []*Param

-----------------------------------------------------------------

----------------------------------------------------------------- We'll use the Exists method to check if a user exists with a specific ID.

func (*RpgParamModel) Save

func (m *RpgParamModel) Save(u *Param) (string, error)

-----------------------------------------------------------------

----------------------------------------------------------------- We'll use the Insert method to add a new record to the "users" table.

func (*RpgParamModel) Update

func (m *RpgParamModel) Update(u *Param, clearCache bool) error

-----------------------------------------------------------------

----------------------------------------------------------------- We'll use the Insert method to add a new record to the "users" table.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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