MCPcopy
hub / github.com/tinode/chat / initSubs

Function initSubs

server/db/common/test_data/test_data.go:178–256  ·  view source on GitHub ↗
(now time.Time, users []*types.User, topics []*types.Topic)

Source from the content-addressed store, hash-verified

176}
177
178func initSubs(now time.Time, users []*types.User, topics []*types.Topic) []*types.Subscription {
179 subs := make([]*types.Subscription, 0, 6)
180 subs = append(subs, &types.Subscription{
181 ObjHeader: types.ObjHeader{
182 CreatedAt: now,
183 UpdatedAt: now.Add(10 * time.Minute),
184 },
185 User: users[0].Id,
186 Topic: topics[0].Id,
187 RecvSeqId: 5,
188 ReadSeqId: 1,
189 ModeWant: 255,
190 ModeGiven: 255,
191 })
192 subs = append(subs, &types.Subscription{
193 ObjHeader: types.ObjHeader{
194 CreatedAt: now,
195 UpdatedAt: now.Add(15 * time.Minute),
196 },
197 User: users[1].Id,
198 Topic: topics[0].Id,
199 RecvSeqId: 6,
200 ReadSeqId: 3,
201 ModeWant: 47,
202 ModeGiven: 47,
203 })
204 subs = append(subs, &types.Subscription{
205 ObjHeader: types.ObjHeader{
206 CreatedAt: now.Add(-10 * time.Hour),
207 UpdatedAt: now.Add(-10 * time.Hour),
208 },
209 User: users[0].Id,
210 Topic: topics[1].Id,
211 RecvSeqId: 9,
212 ReadSeqId: 5,
213 ModeWant: 47,
214 ModeGiven: 47,
215 })
216 subs = append(subs, &types.Subscription{
217 ObjHeader: types.ObjHeader{
218 CreatedAt: now,
219 UpdatedAt: now.Add(20 * time.Minute),
220 },
221 User: users[1].Id,
222 Topic: topics[1].Id,
223 RecvSeqId: 9,
224 ReadSeqId: 5,
225 ModeWant: 47,
226 ModeGiven: 47,
227 })
228 subs = append(subs, &types.Subscription{
229 ObjHeader: types.ObjHeader{
230 CreatedAt: now,
231 UpdatedAt: now.Add(30 * time.Minute),
232 },
233 User: users[2].Id,
234 Topic: topics[2].Id,
235 RecvSeqId: 0,

Callers 1

InitTestDataFunction · 0.85

Calls 2

SetTouchedAtMethod · 0.80
AddMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…