MCPcopy Create free account
hub / github.com/OpenListTeam/OpenList / GetSharings

Function GetSharings

internal/db/sharing.go:17–26  ·  view source on GitHub ↗
(pageIndex, pageSize int)

Source from the content-addressed store, hash-verified

15}
16
17func GetSharings(pageIndex, pageSize int) (sharings []model.SharingDB, count int64, err error) {
18 sharingDB := db.Model(&model.SharingDB{})
19 if err := sharingDB.Count(&count).Error; err != nil {
20 return nil, 0, errors.Wrapf(err, "failed get sharings count")
21 }
22 if err := sharingDB.Order(columnName("id")).Offset((pageIndex - 1) * pageSize).Limit(pageSize).Find(&sharings).Error; err != nil {
23 return nil, 0, errors.Wrapf(err, "failed get find sharings")
24 }
25 return sharings, count, nil
26}
27
28func GetSharingsByCreatorId(creator uint, pageIndex, pageSize int) (sharings []model.SharingDB, count int64, err error) {
29 sharingDB := db.Model(&model.SharingDB{})

Callers 1

GetSharingsFunction · 0.92

Calls 3

columnNameFunction · 0.85
CountMethod · 0.80
LimitMethod · 0.80

Tested by

no test coverage detected