github.com/Aoi-hosizora/ahlib@v1.5.1-0.20230404072829-241b93cf91c7/xstatus/xstatus_db.go (about)

     1  package xstatus
     2  
     3  // DbStatus represents a status value for the result of database operation.
     4  type DbStatus uint64
     5  
     6  const (
     7  	DbUnknown  DbStatus = iota // Unknown (?)
     8  	DbSuccess                  // Success (CRUD)
     9  	DbNotFound                 // Not found (RUD)
    10  	DbExisted                  // Existed (CU)
    11  	DbFailed                   // Failed (CRUD)
    12  
    13  	DbTagA DbStatus = iota + 96 // Tag a, start from 101
    14  	DbTagB                      // Tag b
    15  	DbTagC                      // Tag c
    16  	DbTagD                      // Tag d
    17  	DbTagE                      // Tag e
    18  	DbTagF                      // Tag f
    19  	DbTagG                      // Tag g
    20  )
    21  
    22  func (d DbStatus) String() string {
    23  	switch d {
    24  	case DbUnknown:
    25  		return "db-unknown"
    26  	case DbSuccess:
    27  		return "db-success"
    28  	case DbNotFound:
    29  		return "db-not-found"
    30  	case DbExisted:
    31  		return "db-existed"
    32  	case DbFailed:
    33  		return "db-failed"
    34  	case DbTagA:
    35  		return "db-tag-a"
    36  	case DbTagB:
    37  		return "db-tag-b"
    38  	case DbTagC:
    39  		return "db-tag-c"
    40  	case DbTagD:
    41  		return "db-tag-d"
    42  	case DbTagE:
    43  		return "db-tag-e"
    44  	case DbTagF:
    45  		return "db-tag-f"
    46  	case DbTagG:
    47  		return "db-tag-g"
    48  	default:
    49  		return "db-?"
    50  	}
    51  }