Documentation ¶
Overview ¶
Copyright (c) 2023 the go-mongr8 Authors and Contributors [@see Authors file]
Licensed under the MIT License (https://opensource.org/licenses/MIT)
Copyright (c) 2023 the go-mongr8 Authors and Contributors [@see Authors file]
Licensed under the MIT License (https://opensource.org/licenses/MIT)
Copyright (c) 2023 the go-mongr8 Authors and Contributors [@see Authors file]
Licensed under the MIT License (https://opensource.org/licenses/MIT)
Copyright (c) 2023 the go-mongr8 Authors and Contributors [@see Authors file]
Licensed under the MIT License (https://opensource.org/licenses/MIT)
Copyright (c) 2023 the go-mongr8 Authors and Contributors [@see Authors file]
Licensed under the MIT License (https://opensource.org/licenses/MIT)
Copyright (c) 2023 the go-mongr8 Authors and Contributors [@see Authors file]
Licensed under the MIT License (https://opensource.org/licenses/MIT)
Index ¶
- func AnyToLiteral(value interface{}) string
- func ConvertValueTypeToRealType(value interface{}) interface{}
- type Action
- type SubAction
- func SubActionConvertField(schema SubActionSchema) *SubAction
- func SubActionCreateCollection(schema SubActionSchema) *SubAction
- func SubActionCreateField(schema SubActionSchema) *SubAction
- func SubActionCreateIndex(schema SubActionSchema) *SubAction
- func SubActionDropCollection(schema SubActionSchema) *SubAction
- func SubActionDropField(schema SubActionSchema) *SubAction
- func SubActionDropIndex(schema SubActionSchema) *SubAction
- func (sa SubAction) GetFieldsBsonD() bson.D
- func (sa SubAction) GetFieldsBsonM() bson.M
- func (sa SubAction) GetIndexesBsonD() []dt.Pair[string, dt.Pair[bson.D, bson.D]]
- func (sa SubAction) GetIndexesBsonM() []dt.Pair[string, dt.Pair[bson.M, bson.M]]
- func (sa SubAction) GetLiteralInstance(prefix string, isArrayItem bool) string
- func (sa SubAction) IsUp() bool
- type SubActionIf
- type SubActionSchema
- type SubActionType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnyToLiteral ¶
func AnyToLiteral(value interface{}) string
convert any value to literal, this function can be called any where
func ConvertValueTypeToRealType ¶
func ConvertValueTypeToRealType(value interface{}) interface{}
ConvertValueTypeToRealType return value reversal of ValueType(d) structure as defined in migration/translator/dictionary TODO: find better approach in the future as the ValueType was intended because of to many type conversions needed
Types ¶
type Action ¶
type Action struct { // ActionIf ActionKey string // sub actions should be execute respectively SubActions []SubAction }
Action holds operations that will be performed in a collection
type SubAction ¶
type SubAction struct { SubActionIf // could be the name of collection, index, field, or etc Type SubActionType // schema changed in this action ActionSchema SubActionSchema // contains filtered or unexported fields }
SubAction handles atomic action as part of main Action
func SubActionConvertField ¶
func SubActionConvertField(schema SubActionSchema) *SubAction
func SubActionCreateCollection ¶
func SubActionCreateCollection(schema SubActionSchema) *SubAction
func SubActionCreateField ¶
func SubActionCreateField(schema SubActionSchema) *SubAction
func SubActionCreateIndex ¶
func SubActionCreateIndex(schema SubActionSchema) *SubAction
func SubActionDropCollection ¶
func SubActionDropCollection(schema SubActionSchema) *SubAction
func SubActionDropField ¶
func SubActionDropField(schema SubActionSchema) *SubAction
func SubActionDropIndex ¶
func SubActionDropIndex(schema SubActionSchema) *SubAction
func (SubAction) GetFieldsBsonD ¶
func (SubAction) GetFieldsBsonM ¶
func (SubAction) GetIndexesBsonD ¶
func (SubAction) GetIndexesBsonM ¶
func (SubAction) GetLiteralInstance ¶
type SubActionIf ¶
type SubActionIf interface { // flag whether current sub action is Up or Down IsUp() bool // this will return pairs of index and rule GetIndexesBsonD() []dt.Pair[string, dt.Pair[bson.D, bson.D]] GetIndexesBsonM() []dt.Pair[string, dt.Pair[bson.M, bson.M]] // this will return whole field schema in the collection GetFieldsBsonD() bson.D GetFieldsBsonM() bson.M }
type SubActionSchema ¶
type SubActionSchema struct { // Collection must always be defined // if Fields and Indexes are not defined, then it must be // related to collection option, i.e: Create Collection Collection collection.Metadata Fields []collection.Field Indexes []collection.Index // field type for conversion // we're expecting only a single field conversion // each sub action FieldConvertFrom *field.FieldType }
SubActionSchema holds what are being changed/adjusted in the current SubAction this data will be used to compare the generated migration files schema with the higher level user-defined schema in /mongr8/collection
func (SubActionSchema) GetLiteralInstance ¶
func (sas SubActionSchema) GetLiteralInstance(prefix string, isArrayItem bool) string
type SubActionType ¶
type SubActionType string
const ( SubActionTypeCreateCollection SubActionType = "SubActionTypeCreateCollection" SubActionTypeCreateIndex SubActionType = "SubActionTypeCreateIndex" SubActionTypeCreateField SubActionType = "SubActionTypeCreateField" SubActionTypeConvertField SubActionType = "SubActionTypeConvertField" SubActionTypeDropCollection SubActionType = "SubActionTypeDropCollection" SubActionTypeDropIndex SubActionType = "SubActionTypeDropIndex" SubActionTypeDropField SubActionType = "SubActionTypeDropField" )
make sure constant name is exactly same as it's value
func (SubActionType) ToString ¶
func (sat SubActionType) ToString() string