github.com/cockroachdb/cockroachdb-parser@v0.23.3-0.20240213214944-911057d40c9a/pkg/sql/colexec/execgen/placeholders.go (about)

     1  // Copyright 2019 The Cockroach Authors.
     2  //
     3  // Use of this software is governed by the Business Source License
     4  // included in the file licenses/BSL.txt.
     5  //
     6  // As of the Change Date specified in that file, in accordance with
     7  // the Business Source License, use of this software will be governed
     8  // by the Apache License, Version 2.0, included in the file
     9  // licenses/APL.txt.
    10  
    11  package execgen
    12  
    13  import (
    14  	"github.com/cockroachdb/cockroachdb-parser/pkg/sql/colexecerror"
    15  	"github.com/cockroachdb/errors"
    16  )
    17  
    18  const nonTemplatePanic = "do not call from non-template code"
    19  
    20  // Remove unused warnings.
    21  var (
    22  	_ = COPYVAL
    23  	_ = APPENDSLICE
    24  	_ = APPENDVAL
    25  	_ = SETVARIABLESIZE
    26  )
    27  
    28  // COPYVAL is a template function that can be used to set a scalar to the value
    29  // of another scalar in such a way that the destination won't be modified if the
    30  // source is.
    31  func COPYVAL(dest, src interface{}) {
    32  	colexecerror.InternalError(errors.AssertionFailedf(nonTemplatePanic))
    33  }
    34  
    35  // APPENDSLICE is a template function.
    36  func APPENDSLICE(target, src, destIdx, srcStartIdx, srcEndIdx interface{}) {
    37  	colexecerror.InternalError(errors.AssertionFailedf(nonTemplatePanic))
    38  }
    39  
    40  // APPENDVAL is a template function.
    41  func APPENDVAL(target, v interface{}) {
    42  	colexecerror.InternalError(errors.AssertionFailedf(nonTemplatePanic))
    43  }
    44  
    45  // SETVARIABLESIZE is a template function.
    46  func SETVARIABLESIZE(target, value interface{}) interface{} {
    47  	colexecerror.InternalError(errors.AssertionFailedf(nonTemplatePanic))
    48  	return nil
    49  }