github.com/machinefi/w3bstream@v1.6.5-rc9.0.20240426031326-b8c7c4876e72/pkg/models/resource.go (about)

     1  package models
     2  
     3  import (
     4  	"github.com/machinefi/w3bstream/pkg/depends/base/types"
     5  	"github.com/machinefi/w3bstream/pkg/depends/kit/sqlx/datatypes"
     6  )
     7  
     8  // Resource database model wasm_resource
     9  // @def primary                     ID
    10  // @def unique_index UI_resource_id ResourceID
    11  // @def unique_index UI_md5         Md5
    12  //
    13  //go:generate toolkit gen model Resource --database DB
    14  type Resource struct {
    15  	datatypes.PrimaryID
    16  	RelResource
    17  	ResourceInfo
    18  	datatypes.OperationTimes
    19  }
    20  
    21  type RelResource struct {
    22  	ResourceID types.SFID `db:"f_resource_id" json:"resourceID"`
    23  }
    24  
    25  type ResourceInfo struct {
    26  	Path string `db:"f_path,default=''" json:"path"` // Path rel path
    27  	Md5  string `db:"f_md5"             json:"md5"`
    28  }