github.com/geniusesgroup/libgo@v0.0.0-20220713101832-828057a9d3d4/syllab/dynaimc-size-types.go (about)

     1  /* For license and copyright information please see LEGAL file in repository */
     2  
     3  package syllab
     4  
     5  /*
     6  ----encoder references in GoLang----
     7  // Read more about this encoder : https://github.com/SabzCity/RFCs/blob/master/Syllab.md
     8  
     9  fixed sized data types:
    10  - [1]byte	: byte, int8, uint8, bool
    11  - [2]byte	: int16, uint16
    12  - [4]byte	: int32, uint32, float32, rune
    13  - [8]byte	: int64, uint64, float64, int, uint, complex64
    14  - [16]byte	: complex128
    15  - [n]byte	: [n]byte
    16  */
    17  
    18  // slice in go make by this struct internally! we just omit cap var due to transfer data has distinct size!
    19  // It is just to show encoder||decoder in better way, we never use this type!
    20  type slice struct {
    21      len int
    22  	cap int
    23  	ptr uintptr
    24  }
    25  
    26  // dynamicallyArray use for dynamically sized array data type
    27  // that peer don't know about length of array before get data like []string, []uint8, ...
    28  // It is just to show encoder||decoder structure in better way, we never use this type in any process!
    29  type dynamicallyArray struct {
    30  	address uint32
    31  	length  uint32
    32  }
    33  
    34  // maps can encode and decode HashTable by two way
    35  // - By two Array one for keys and one for values [key0, key1, ...] & [value0, value1, ...]
    36  // - By continuous key and value that need dedicated encoder and decoder for each need!
    37  // By now we just support first way in this package!
    38  // It is just to show encoder structure in better way, we never use this type!
    39  // https://github.com/golang/go/blob/master/src/runtime/map.go
    40  type maps struct {
    41  	keys   dynamicallyArray
    42  	values dynamicallyArray
    43  }