github.com/pf-qiu/concourse/v6@v6.7.3-0.20201207032516-1f455d73275f/atc/db/resource_cache_user.go (about)

     1  package db
     2  
     3  // ResourceCacheUser designates the column to set in the resource_cache_users
     4  // table.
     5  type ResourceCacheUser interface {
     6  	SQLMap() map[string]interface{}
     7  }
     8  
     9  type forBuild struct {
    10  	BuildID int
    11  }
    12  
    13  func ForBuild(id int) ResourceCacheUser {
    14  	return forBuild{id}
    15  }
    16  
    17  func (user forBuild) SQLMap() map[string]interface{} {
    18  	return map[string]interface{}{
    19  		"build_id": user.BuildID,
    20  	}
    21  }
    22  
    23  type forContainer struct {
    24  	ContainerID int
    25  }
    26  
    27  func ForContainer(id int) ResourceCacheUser {
    28  	return forContainer{id}
    29  }
    30  
    31  func (user forContainer) SQLMap() map[string]interface{} {
    32  	return map[string]interface{}{
    33  		"container_id": user.ContainerID,
    34  	}
    35  }