-
Notifications
You must be signed in to change notification settings - Fork 6
/
mutez.go
56 lines (47 loc) · 1.02 KB
/
mutez.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package ast
import "github.com/dipdup-net/go-lib/tools/consts"
//
// MUTEZ
//
// Mutez -
type Mutez struct {
Default
}
// NewMutez -
func NewMutez(depth int) *Mutez {
return &Mutez{
Default: NewDefault(consts.MUTEZ, 0, depth),
}
}
// ToJSONSchema -
func (m *Mutez) ToJSONSchema() (*JSONSchema, error) {
return getIntJSONSchema(m.Default), nil
}
// Compare -
func (m *Mutez) Compare(second Comparable) (int, error) {
secondItem, ok := second.(*Mutez)
if !ok {
return 0, consts.ErrTypeIsNotComparable
}
return compareBigInt(m.Default, secondItem.Default), nil
}
// Distinguish -
func (m *Mutez) Distinguish(x Distinguishable) (*MiguelNode, error) {
second, ok := x.(*Mutez)
if !ok {
return nil, nil
}
return m.Default.Distinguish(&second.Default)
}
// FromJSONSchema -
func (m *Mutez) FromJSONSchema(data map[string]interface{}) error {
setIntJSONSchema(&m.Default, data)
return nil
}
// FindByName -
func (m *Mutez) FindByName(name string, isEntrypoint bool) Node {
if m.GetName() == name {
return m
}
return nil
}