yaorm

module
v0.0.1-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 26, 2022 License: MIT

README

yaORM

Yet Another Object–Relational Mapping, is a ORM using Go 1.18

Summary

  1. How To Use a. Defining Models

How To Use

Defining Models

You can declare a simple model using the following struct:

import (
  "github.com/fiuskylab/yaorm/model"
)
type User struct {
  model.Model
  Name  string `json:"name"`
  Email string `json:"email"`
}

The model.Model is:

// Model is the base for yaORM
type Model struct {
	ID        int       `json:"id" yaorm:"pk,autoincrement:true"`
	CreatedAt time.Time `json:"created_at" yaorm:"trigger:create"`
	UpdatedAt time.Time `json:"updated_at" yaorm:"trigger:update"`
	DeletedAt time.Time `json:"deleted_at" yaorm:"trigger:delete"`
}

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL