Code.go
package model
import (
"github.com/saseul/vm"
"github.com/saseul/util"
)
type Code struct {
Type string `json:"type"`
Machine string `json:"machine"`
Name string `json:"name"`
Version string `json:"version"`
Space string `json:"space"`
Writer string `json:"writer"`
Parameters map[string]map[string]interface{} `json:"parameters"`
Executions []interface{} `json:"executions"`
}
func NewCode() *Code {
return &Code{
Type: "code",
Parameters: make(map[string]map[string]interface{}),
}
}
func (c *Code) Cid() string {
return util.SpaceID(c.Writer, c.Space)
}
func (c *Code) GetType() string {
return c.Type
}
func (c *Code) SetType(t string) {
c.Type = t
}
func (c *Code) GetMachine() string {
return c.Machine
}
func (c *Code) SetMachine(m string) {
c.Machine = m
}
func (c *Code) GetName() string {
return c.Name
}
func (c *Code) SetName(n string) {
c.Name = n
}
func (c *Code) GetVersion() string {
return c.Version
}
func (c *Code) SetVersion(v string) {
c.Version = v
}
func (c *Code) GetSpace() string {
return c.Space
}
func (c *Code) SetSpace(s string) {
c.Space = s
}
func (c *Code) GetWriter() string {
return c.Writer
}
func (c *Code) SetWriter(w string) {
c.Writer = w
}
func (c *Code) AddParameter(parameter *vm.Parameter) {
if parameter.ObjValidity() && c.Parameters[parameter.Name()] == nil {
c.Parameters[parameter.Name()] = parameter.Obj()
}
}
func (c *Code) GetParameters() map[string]map[string]interface{} {
return c.Parameters
}
func (c *Code) AddExecution(execution interface{}) {
c.Executions = append(c.Executions, execution)
}
func (c *Code) GetExecutions() []interface{} {
return c.Executions
}Code 구조체
Code 구조체생성자 함수
필드 접근자 및 설정자 메서드
매개변수 관련 메서드
실행 관련 메서드
요약
Last updated