Skip to content

Latest commit

 

History

History
41 lines (35 loc) · 1.24 KB

README.md

File metadata and controls

41 lines (35 loc) · 1.24 KB
title keywords description
Entgo ORM (MySQL)
ent
mysql
orm
rest
Using Entgo ORM with MySQL

Example ent ORM for fiber with MySQL

Github StackBlitz

A sample program how to connect ent ORM

How to start (If no ent dir)

Execute command first

go run -mod=mod entgo.io/ent/cmd/ent new Book

go to ./ent/schema/book.go and add fields(you want) to Book Schema

// Fields of the Book.
func (Book) Fields() []ent.Field {
	return []ent.Field{
		field.String("title").NotEmpty(),
		field.String("author").NotEmpty(),
	}
}

Execute command

go generate ./ent

Endpoints

Method URL Description
GET /book All Books Info
GET /book:id One Book Info
POST /create One Book Add
PUT /update/:id One Book Update
DELETE /delete/:id One Book Delete