File: marshal_limits.go

package info (click to toggle)
golang-github-tinylib-msgp 1.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,652 kB
  • sloc: makefile: 48
file content (23 lines) | stat: -rw-r--r-- 1,068 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//msgp:limit arrays:30 maps:20 marshal:true

package _generated

//go:generate msgp

// Test structures for marshal-time limit enforcement
type MarshalLimitTestData struct {
	SmallArray [5]int         `msg:"small_array"`
	TestSlice  []string       `msg:"test_slice"`
	TestMap    map[string]int `msg:"test_map"`
}

// Test field limits vs file limits precedence with marshal:true
// File limits: arrays:30 maps:20 marshal:true
type MarshalFieldOverrideTestData struct {
	TightSlice   []int            `msg:"tight_slice,limit=10"`  // Field limit (10) < file limit (30)
	LooseSlice   []string         `msg:"loose_slice,limit=50"`  // Field limit (50) > file limit (30)
	TightMap     map[string]int   `msg:"tight_map,limit=5"`     // Field limit (5) < file limit (20)
	LooseMap     map[int]string   `msg:"loose_map,limit=40"`    // Field limit (40) > file limit (20)
	DefaultSlice []byte           `msg:"default_slice"`         // No field limit, uses file limit (30)
	DefaultMap   map[string]byte  `msg:"default_map"`           // No field limit, uses file limit (20)
}