Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for RTrimSlice (0.11 sec)

  1. utils/utils.go

    func JoinNestedRelationNames(relationNames []string) string {
    	return strings.Join(relationNames, nestedRelationSplit)
    }
    
    // RTrimSlice Right trims the given slice by given length
    func RTrimSlice[T any](v []T, trimLen int) []T {
    	if trimLen >= len(v) { // trimLen greater than slice len means fully sliced
    		return v[:0]
    	}
    	if trimLen < 0 { // negative trimLen is ignored
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Thu Aug 22 11:03:42 UTC 2024
    - 4.1K bytes
    - Viewed (0)
  2. utils/utils_test.go

    			trimLen:  -1,
    			expected: []int{1, 2, 3},
    		},
    	}
    
    	for _, testcase := range tests {
    		t.Run(testcase.name, func(t *testing.T) {
    			result := RTrimSlice(testcase.input, testcase.trimLen)
    			if !AssertEqual(result, testcase.expected) {
    				t.Errorf("RTrimSlice(%v, %d) = %v; want %v", testcase.input, testcase.trimLen, result, testcase.expected)
    			}
    		})
    	}
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Thu Aug 22 11:03:42 UTC 2024
    - 4.9K bytes
    - Viewed (0)
  3. callbacks/query.go

    	if v, ok := db.Statement.Clauses["FROM"].Expression.(clause.From); ok {
    		fromClause := db.Statement.Clauses["FROM"]
    		fromClause.Expression = clause.From{Tables: v.Tables, Joins: utils.RTrimSlice(v.Joins, len(db.Statement.Joins))} // keep the original From Joins
    		db.Statement.Clauses["FROM"] = fromClause
    	}
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Thu Aug 22 11:03:42 UTC 2024
    - 10.1K bytes
    - Viewed (0)
Back to top