github.com/vedadiyan/sqlparser@v1.0.0/pkg/query/cached_size.go (about)

     1  /*
     2  Copyright 2021 The Vitess Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  // Code generated by Sizegen. DO NOT EDIT.
    17  
    18  package query
    19  
    20  import hack "github.com/vedadiyan/sqlparser/pkg/hack"
    21  
    22  func (cached *BindVariable) CachedSize(alloc bool) int64 {
    23  	if cached == nil {
    24  		return int64(0)
    25  	}
    26  	size := int64(0)
    27  	if alloc {
    28  		size += int64(96)
    29  	}
    30  	// field unknownFields []byte
    31  	{
    32  		size += hack.RuntimeAllocSize(int64(cap(cached.unknownFields)))
    33  	}
    34  	// field Value []byte
    35  	{
    36  		size += hack.RuntimeAllocSize(int64(cap(cached.Value)))
    37  	}
    38  	// field Values []*vitess.io/vitess/go/vt/proto/query.Value
    39  	{
    40  		size += hack.RuntimeAllocSize(int64(cap(cached.Values)) * int64(8))
    41  		for _, elem := range cached.Values {
    42  			size += elem.CachedSize(true)
    43  		}
    44  	}
    45  	return size
    46  }
    47  func (cached *Field) CachedSize(alloc bool) int64 {
    48  	if cached == nil {
    49  		return int64(0)
    50  	}
    51  	size := int64(0)
    52  	if alloc {
    53  		size += int64(160)
    54  	}
    55  	// field unknownFields []byte
    56  	{
    57  		size += hack.RuntimeAllocSize(int64(cap(cached.unknownFields)))
    58  	}
    59  	// field Name string
    60  	size += hack.RuntimeAllocSize(int64(len(cached.Name)))
    61  	// field Table string
    62  	size += hack.RuntimeAllocSize(int64(len(cached.Table)))
    63  	// field OrgTable string
    64  	size += hack.RuntimeAllocSize(int64(len(cached.OrgTable)))
    65  	// field Database string
    66  	size += hack.RuntimeAllocSize(int64(len(cached.Database)))
    67  	// field OrgName string
    68  	size += hack.RuntimeAllocSize(int64(len(cached.OrgName)))
    69  	// field ColumnType string
    70  	size += hack.RuntimeAllocSize(int64(len(cached.ColumnType)))
    71  	return size
    72  }
    73  func (cached *QueryWarning) CachedSize(alloc bool) int64 {
    74  	if cached == nil {
    75  		return int64(0)
    76  	}
    77  	size := int64(0)
    78  	if alloc {
    79  		size += int64(64)
    80  	}
    81  	// field unknownFields []byte
    82  	{
    83  		size += hack.RuntimeAllocSize(int64(cap(cached.unknownFields)))
    84  	}
    85  	// field Message string
    86  	size += hack.RuntimeAllocSize(int64(len(cached.Message)))
    87  	return size
    88  }
    89  func (cached *Target) CachedSize(alloc bool) int64 {
    90  	if cached == nil {
    91  		return int64(0)
    92  	}
    93  	size := int64(0)
    94  	if alloc {
    95  		size += int64(96)
    96  	}
    97  	// field unknownFields []byte
    98  	{
    99  		size += hack.RuntimeAllocSize(int64(cap(cached.unknownFields)))
   100  	}
   101  	// field Keyspace string
   102  	size += hack.RuntimeAllocSize(int64(len(cached.Keyspace)))
   103  	// field Shard string
   104  	size += hack.RuntimeAllocSize(int64(len(cached.Shard)))
   105  	// field Cell string
   106  	size += hack.RuntimeAllocSize(int64(len(cached.Cell)))
   107  	return size
   108  }
   109  func (cached *Value) CachedSize(alloc bool) int64 {
   110  	if cached == nil {
   111  		return int64(0)
   112  	}
   113  	size := int64(0)
   114  	if alloc {
   115  		size += int64(80)
   116  	}
   117  	// field unknownFields []byte
   118  	{
   119  		size += hack.RuntimeAllocSize(int64(cap(cached.unknownFields)))
   120  	}
   121  	// field Value []byte
   122  	{
   123  		size += hack.RuntimeAllocSize(int64(cap(cached.Value)))
   124  	}
   125  	return size
   126  }