github.com/iasthc/atlas/cmd/atlas@v0.0.0-20230523071841-73246df3f88d/internal/migrate/ent/convert.go (about)

     1  // Copyright 2021-present The Atlas Authors. All rights reserved.
     2  // This source code is licensed under the Apache 2.0 license found
     3  // in the LICENSE file in the root directory of this source tree.
     4  
     5  // Code generated by entc, DO NOT EDIT.
     6  
     7  package ent
     8  
     9  import "github.com/iasthc/atlas/sql/migrate"
    10  
    11  // SetRevision takes the values for each field from the given migrate.Revision.
    12  func (rc *RevisionCreate) SetRevision(rev *migrate.Revision) *RevisionCreate {
    13  	rc.SetID(rev.Version)
    14  	rc.SetDescription(rev.Description)
    15  	rc.SetType(rev.Type)
    16  	rc.SetApplied(rev.Applied)
    17  	rc.SetTotal(rev.Total)
    18  	rc.SetExecutedAt(rev.ExecutedAt)
    19  	rc.SetExecutionTime(rev.ExecutionTime)
    20  	rc.SetError(rev.Error)
    21  	rc.SetErrorStmt(rev.ErrorStmt)
    22  	rc.SetHash(rev.Hash)
    23  	rc.SetPartialHashes(rev.PartialHashes)
    24  	rc.SetOperatorVersion(rev.OperatorVersion)
    25  	return rc
    26  }
    27  
    28  // AtlasRevision returns an migrate.Revision from the current Revision.
    29  func (r *Revision) AtlasRevision() *migrate.Revision {
    30  	return &migrate.Revision{
    31  		Version:         r.ID,
    32  		Description:     r.Description,
    33  		Type:            r.Type,
    34  		Applied:         r.Applied,
    35  		Total:           r.Total,
    36  		ExecutedAt:      r.ExecutedAt,
    37  		ExecutionTime:   r.ExecutionTime,
    38  		Error:           r.Error,
    39  		ErrorStmt:       r.ErrorStmt,
    40  		Hash:            r.Hash,
    41  		PartialHashes:   r.PartialHashes,
    42  		OperatorVersion: r.OperatorVersion,
    43  	}
    44  }