code: def setFromBuff(self, buff):
      start = 0
  
      if self.var_len == "lenenc":
          start = 1
          ln_enc = buff[0]
          if int(ln_enc) <= ONE_BYTE_ENC[0]:
              start = 0
              end = 1
          elif int(ln_enc) == TWO_BYTE_ENC[0]:
              end = 3
          elif int(ln_enc) == THREE_BYTE_ENC[0]:
              end = 4
          elif ln_enc:
              end = 9
  
          num_str = buff[start:end]
          if end > 9:
              logger.error("Cant decode integer greater than 8 bytes")
              return buff[end - 1 :]  # noqa: E203
  
          for j in range(8 - (end - start)):
              num_str += b"\0"
  
          if self.var_type == "int":
              self.value = struct.unpack("i", num_str)
              return buff[end:]
  
          if self.var_type in ["byte", "string"]:
              length = struct.unpack("Q", num_str)[0]
              self.value = buff[end : (length + end)]  # noqa: E203
              return buff[(length + end) :]  # noqa: E203
  
      if self.var_len == "EOF":
          length = len(buff)
          self.var_len = str(length)
          self.value = buff
          return ""
      else:
          length = self.var_len
  
      if self.type == "string<NUL>":
          for j, x in enumerate(buff):
              if int(x) == 0:
                  length = j + 1
                  break
  
      length = int(length)
      if self.var_type in ["byte", "string"]:
          end = length
          self.value = buff[:end]
      else:  # if its an integer
          end = length
          num_str = buff[:end]
          if end > 8:
              logger.error("cant decode integer greater than 8 bytes")
              return buff[end:]
          for j in range(8 - end):
              num_str += b"\0"
          self.value = struct.unpack("Q", num_str)[0]
      if str(self.var_len) == "NUL":
          self.value = self.value[:-1]
      return buff[end:]
  
file_path: mindsdb/mindsdb/api/mysql/mysql_proxy/data_types/mysql_datum.py
imports: import math
  import struct
  from mindsdb.api.mysql.mysql_proxy.libs.constants.mysql import DEFAULT_CAPABILITIES, NULL_VALUE, ONE_BYTE_ENC, THREE_BYTE_ENC, TWO_BYTE_ENC
  from mindsdb.utilities import log
label_desc: Use image node_id 3 for calling the Datum obj's underlying member method code with example usage: obj.setFromBuff(buff) and returns: buff, str, buff, buff, buff, buff