-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadvanceDataTypes.yaml
114 lines (97 loc) · 1.67 KB
/
advanceDataTypes.yaml
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
student: !!seq
- marks
- name
- roll_no
# like this also
cities: [gujarat, goa]
# some of the keys of the seq will be empty
# sparse seq
sparse seq:
- hey
- how
-
- Null
- sup
# nested sequence
-
- mango
- apple
- banana
-
-
- marks
- name
- date
-
# key: value pairs are called maps
!!map
#nested mappings: map within an map
name: Brijesh Thummar
role:
age: 18
job: student
# same as
name: Brijesh Thummar
role: { age: 18 , job: student }
# pairs: keys may have duplicate values
# !!pairs
pair example: !!pairs
- job: student
- job: teacher
# same as
pair example: !!pairs [job: student , job: teacher]
# this will be an array of hashtables
# !!set will allow you to have unique values
names: !!set
? Brijesh
? Ram
? Harsh
# dictionary !!omap
people: !!omap
- Brijesh:
name: Brijesh Thummar
age: 18
height: 181
- Ram:
name: Ram Pandit
age: 32
height: 167
# reusing some properties
likings:
fav fruit: mango
dislikes: dragon fruit
person1:
name: Brijesh Thummar
fav fruit: mango
dislikes: dragon fruit
person2:
name: Rahul
fav fruit: mango
dislikes: dragon fruit
person3:
name: Ram
fav fruit: mango
dislikes: dragon fruit
---
# reusing some properties using anchors -> anchors: what and where do you want to copy it.
likings: &likes # give & ---name
fav fruit: mango
dislikes: dragon fruit
person1:
name: Brijesh Thummar
<<: *likes
person2:
name: Rahul
<<: *likes
dislikes: berries # everything will be copied and dislike will be updated
---
# this will look like
person2:
name: Ram
fav fruit: mango
dislikes: berries
---
person3:
name: Ram
fav fruit: mango
dislikes: dragon fruit