File: convert.go

package info (click to toggle)
golang-ariga-atlas 0.7.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 5,676 kB
  • sloc: javascript: 592; sql: 404; makefile: 10
file content (42 lines) | stat: -rw-r--r-- 1,302 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright 2021-present The Atlas Authors. All rights reserved.
// This source code is licensed under the Apache 2.0 license found
// in the LICENSE file in the root directory of this source tree.

// Code generated by entc, DO NOT EDIT.

package ent

import "ariga.io/atlas/sql/migrate"

// SetRevision takes the values for each field from the given migrate.Revision.
func (rc *RevisionCreate) SetRevision(rev *migrate.Revision) *RevisionCreate {
	rc.SetID(rev.Version)
	rc.SetDescription(rev.Description)
	rc.SetType(rev.Type)
	rc.SetApplied(rev.Applied)
	rc.SetTotal(rev.Total)
	rc.SetExecutedAt(rev.ExecutedAt)
	rc.SetExecutionTime(rev.ExecutionTime)
	rc.SetError(rev.Error)
	rc.SetHash(rev.Hash)
	rc.SetPartialHashes(rev.PartialHashes)
	rc.SetOperatorVersion(rev.OperatorVersion)
	return rc
}

// AtlasRevision returns an migrate.Revision from the current Revision.
func (r *Revision) AtlasRevision() *migrate.Revision {
	return &migrate.Revision{
		Version:         r.ID,
		Description:     r.Description,
		Type:            r.Type,
		Applied:         r.Applied,
		Total:           r.Total,
		ExecutedAt:      r.ExecutedAt,
		ExecutionTime:   r.ExecutionTime,
		Error:           r.Error,
		Hash:            r.Hash,
		PartialHashes:   r.PartialHashes,
		OperatorVersion: r.OperatorVersion,
	}
}